plotfft.m

来自「是“MATLAB混合编程与工程应用”一书的源码」· M 代码 · 共 18 行

M
18
字号
function PlotFFT(fftData, freq, powerSpect)
%PLOTFFT Plots the FFT and power spectral density data
%   PLOTFFT(FFTDATA, FREQ, POWERSPECT)
%   Plots the FFT and power spectral density from the specified data.
%   This file is used as an example for the .NET Builder
%   Language product.

%   Copyright 2001-2005 The MathWorks, Inc.
%   $Revision: 1.1.10.1 $  $Date: 2005/12/22 17:57:56 $

    len = length(fftData);
    if (len <= 0)
        return;
    end
    plot(freq(1:floor(len/2)), powerSpect(1:floor(len/2)))
    xlabel('Frequency (Hz)'), grid on
    title('Power spectral density')

⌨️ 快捷键说明

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