fourier.m

来自「本文件采用Matlab软件」· M 代码 · 共 39 行

M
39
字号
% Numerical Inversion of Laplace Transforms: 
% The Fourier Series Approximation

% Author's Data: Housam BINOUS
% Department of Chemical Engineering
% National Institute of Applied Sciences and Technology
% Tunis, TUNISIA
% Email: binoushousam@yahoo.com 

% We perform numerical inversion of F(s)=1/(s^2+1)
% Result is compared to the analytical solution f(t)=sin(t)

Er=10^-8;

sg0=0.001;

T=50;

sg=sg0-log(Er)/(2*T);

t=0.01:0.01:10;

f=zeros(1,1000);

f=f+1/2*1/(sg^2+1);

for p=1:2000
    f=f+real(1/((sg+p*pi*i/T)^2+1).*cos(p*pi*t/T))...
        -imag(1/((sg+p*pi*i/T)^2+1).*sin(p*pi*t/T));
end

f=f.*exp(sg*t)/T

plot(t,f,'c*')

hold on

plot(t,sin(t),'b')

⌨️ 快捷键说明

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