📄 demo5.m
字号:
% uses up from demo0disp('Constant cosine-waves with window')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=cos(2*pi*f0'*t);x=1+ones(1,size(f0,2))*x;title('Cosine waves')
xlabel('Time')
plot(t,x)input('Any key to continue')disp(' Window x');%Half Gaussian%w=exp(-(t./(0.5*Tp)).^2);%Full Gaussianw=exp(-((t-Tp/2)./(0.2*Tp)).^2);x=x.*w.*N/sum(w);title('Windowed data and Window')
plot(t,w,t,x);input('Any key to continue')disp('Generate DFT (X) of time series (x) and Compare with Fourier transform of continous data');XD=2*Ts*fft(x);XD(1)=0.5*XD(1);title('Discrete Fourier Transform Spectra of Windowed data')xlabel('Frequency/fs')ylabel ('abs(X)')plot(f/fs,abs(XD),'-',f0/fs,ones(1,size(f0,2)),'+')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -