plotdft.m
来自「matlab在电力电子技术仿真中运用」· M 代码 · 共 23 行
M
23 行
function plotdft(x, fs)
%plots fft of x versus frequency for 0..fs/2
% where fs is the sampling frequency in Hz
% usage: plotdft(x, fs)
N=length(x); %set length
f=[0:fs/(N-1):fs/2]; %calculate frequency sample points
dft=abs(fft(x)); %calculate DFT
stem(f,dft(1:N/2)); %produce plot
axis([0, fs/2,0,max(dft)]); %scale axis to keep them neat!
title('DFT 0..fs/2'); %finally, label every thing...
xlabel('frequency (Hz)');
ylabel('amplitude');
%David Phillips 09507351
%Curtin Univeristy Linear systems 202
%23 October 2000
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?