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

📄 integral.m

📁 很多matlab的源代码
💻 M
字号:
function tf = integral(x)
% INTEGRAL Integral of x(t) = Kexp(-at)(t^p)cos(wt+r)u(t)
%
%	I = INTEGRAL(X) computes the integral of 
%     	x(t) = Kexp(-at)(t^p)cos(wt+r)u(t) over 0 to inf 
%	X is a 5 element array with X=[K a p w r]
%
%	INTEGRAL with no input arguments invokes the following example:
%
%  	% Find the integral of 4texp(-3t)sin(2t)u(t)
% 	  >>i = integral([4 3 1 2 -pi/2])


% 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 integral,disp('Strike a key to see results of the example')
pause,i=integral([4 3 1 2 -pi/2]),return,end

x=[x(:).' zeros(1,5-length(x))];
if x(2)<=0,error('must have decaying exponentials'),return,end
if x(3)<0,error('powers of t cannot be negative'),return,end
if x(4)<0,x(4)=-x(4);x(5)=-x(5);end

%Special case: Damped exponential
if x(4)==0
c=1;if x(5)~=0,c=cos(x(5));end
%Now find integral of c*x1*exp(-x2*t)*(t^x3)
p=x(3)+1;tf=c*x(1)*gm(p)/(x(2)^p);
return,end

%General case: Damped sinusoid & exp
if rem(x(3),2)==0,r=1;else,r=-1;end

if x(5)==0   %pure cosine
[n,d]=chain([1 0],[1 0 x(4)*x(4)],x(3)); %d/da [a/(a*a+b*b)]
tf=polyval(n,x(2))/polyval(d,x(2));      %Evaluate for a
elseif abs(x(5))==pi/2  %pure sine
[n,d]=chain(x(4),[1 0 x(4)*x(4)],x(3));  %d/da [b/(a*a+b*b)]
tf=-sign(x(5))*polyval(n,x(2))/polyval(d,x(2));
else
[n1,d1]=chain([1 0],[1 0 x(4)*x(4)],x(3));
tf1=polyval(n1,x(2))/polyval(d1,x(2));
[n2,d2]=chain(x(4),[1 0 x(4)*x(4)],x(3));
tf2=polyval(n2,x(2))/polyval(d2,x(2));
tf=cos(x(5))*tf1-sin(x(5))*tf2;
end
tf=r*x(1)*tf;

⌨️ 快捷键说明

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