⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pairsum.m

📁 很多matlab的源代码
💻 M
字号:
function r = pairsum(a,b)
% PAIRSUM Pairwise sum to find convolution range endpoints.
%
%	R = PAIRSUM(XE,YE) Computes range endpoints for the convolution X*Y.
% 	XE, YE  are the time interval endpoints of the piecewise signals X & Y.
%	R returns the endpoints of the convolution ranges.
%
%	PAIRSUM (with no input arguments) invokes the following example:
%
%	% Let X have different expressions over -2<t<1, 1<t<3, zero elsewhere
%	% Let Y be defined over 1<t<2, 2<t<4, 4<t<7 and zero elsewhere
%	% We create the arrays XE = [-2 1 3] and YE = [1 2 4 7] and 
%	% find the convolution range endpoints in TR where
%	  >>t = pairsum([-2 1 3],[1 2 4 7])


% ADSP Toolbox: Version 2.0 
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998


if nargin==0,help pairsum,disp('Strike a key to see results of the example')
pause,TR=pairsum([-2 1 3],[1 2 4 7]),return,end

n=length(a);m=length(b);
p=[];for j=1:n,p=[p a(j)+b];end
p1=sort(p);r(1)=p1(1);j=1;
for k=2:m*n,
if p1(k)~=p1(k-1),j=j+1;r(j)=p1(k);end,
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -