📄 energy.m
字号:
function e = energy(x)
% ENERGY Energy in x(t) = Kexp(-at)(t^p)cos(wt+r)u(t)
%
% E = ENERGY(X) computes the the energy 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]
%
% ENERGY with no input arguments invokes the following example:
%
% % Find the energy in 4texp(-3t)sin(2t)u(t)
% >>ex = energy([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 energy,disp('Strike a key to see results of the example')
pause,ex=energy([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
x=[x(1)*x(1) 2*x(2:5)];
e1=integral(x(1:3));
if x(4)==0,e=e1*x(1);if x(5)~=0,e=0.25*e*x(5)*x(5);end,return,end
e2=integral(x);
e=0.5*(e1+e2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -