📄 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 + -