?? fftpower.m
字號:
function [y,freq] = fftpower(x,startpoint,endpoint,fs,varargin)
%FFTPOWER calculate the fft power spectrum density data.
% y = fftpower(x,startpoint,endpoint,fs), x could be real or complex,
% (endpoint-startpoint+1) is the FFT point. fs is the sample frequency.
% Author:Harrison Zheng
% ShenZhen HYT Science&Technology CO.,LTD.
% Date:2006.12.22
if (startpoint>=endpoint)
error('start point could not be larger than end point');
end
[m,n] = size(x);
if ~(m==1 || n==1)
error('input signal should be one dimension vector');
end
x = x(:);
fftpoint = endpoint - startpoint + 1;
y = abs(fftshift(fft(x(startpoint:endpoint),fftpoint)));
y = y(:);
freq = [-fs/2:fs/fftpoint:fs/2-fs/fftpoint]';
% End of Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -