demo1.m
来自「这是一个 York大学开发的FDTD代码。很好用的工具」· M 代码 · 共 29 行
M
29 行
disp('Demonstrate Pulse constructed from Fourier series')disp('Generate time and frequency steps')Ts=Tp/(N)fs=1/Tsf=linspace(0,fs*(N-1)/N,N);disp('Generate time steps for one period (t)');t=linspace(0,Tp*(N-1)/N,N);disp('Generate time sequence (x) and plot it against time (t)')x=prect(t,Tw,Tp);plot(t,x)
title('Periodic Rectangular pulse train')
input('Any key to continue')disp('Generate & plot Fourier coefficients for pulse')k=-K:K;X = Tw * sinc(k*(Tw)/Tp);plot(k,X,'*')
title('Fourier Coeficients')input('Any key to continue')disp('Generate time sequence (xr) from coefficients and plot it against time (t)')xr=idft(t/Tp,X,k);plot(t,x,t,real(xr))title('Original and Reconstructed pulse')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?