📄 ip_01_06.m
字号:
% MATLAB script for Illustrative Problem 6, Chapter 1echo onts=0.2; % set parametersfs=1/ts;df=0.01;x=[zeros(1,10),[0:0.2:1],ones(1,9),[1:-0.2:0],zeros(1,10)];[X,x,df1]=fftseq(x,ts,df); % derive the FFTX1=X/fs; % scalingf=[0:df1:df1*(length(x)-1)]-fs/2; % frequency vector for FFTf1=[-2.5:0.001:2.5]; % frequency vector for analytic approachy=4*(sinc(2*f1)).^2-(sinc(f1)).^2; % Exact Fourier Transformpause % Press akey to see the plot of the Fourier Transform derived analyticallyclfsubplot(2,1,1)plot(f1,abs(y));xlabel('Frequency')title('Magnitude-pectrum of x(t) derived analytically')pause % Press akey to see the plot of the Fourier Transform derived numericallysubplot(2,1,2)plot(f,fftshift(abs(X1)));xlabel('Frequency')title('Magnitude-pectrum of x(t) derived numerically')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -