ex9_5.m

来自「Advanced Engineering Mathematics using M」· M 代码 · 共 23 行

M
23
字号
% EX9_5.M Compute the spectrum of a signal saved%   in file CLEX95.MAT. (Created by CLEX95DT.M) The data are:%   N   samples of the |FFT| are plotted%   Ts   sampling interval in seconds%   t   time points%   ft  function f(t)% Calls clfftf to compute DFTload clex95.mat                    % Load N,Ts,t,ftfs=1/(N*Ts);                       % Frequency spacing	fhertz=fs*linspace(-N/2,N/2-1,N);  % Create frequency axis[FT,FTmag,FTarg]=clfftf(ft,N,Ts);  % Compute DFT% Plot f(t) and DFT subplot(2,1,1), plot(t,ft)         % Time functiontitle('Signal')xlabel('Time in seconds'), ylabel('f(t)')subplot(2,1,2),plot(fhertz, FTmag) % Spectrumxlabel('Frequency in hertz')ylabel('Spectrum')%% Modify the script to use other data files. The M-file%  that created the data file is CLEX95DT.M

⌨️ 快捷键说明

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