加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
PTSpec2d.m 799 Bytes
一键复制 编辑 原始数据 按行查看 历史
Brian White 提交于 2019-03-28 12:02 . Add files via upload
function [freq amp2d] = PTSpec2d(Y, F)
%% [freq amp2d] = PTSpec2d(Y, F)
% computes standard fft on input data Y. F is sample frequency in Hz.
% ----------------------------------------------------------------------------------
% "THE BEER-WARE LICENSE" (Revision 42):
% <brian.white@queensu.ca> wrote this file. As long as you retain this notice you
% can do whatever you want with this stuff. If we meet some day, and you think
% this stuff is worth it, you can buy me a beer in return. -Brian White
% ----------------------------------------------------------------------------------
Y2 = fft(Y);
L=length(Y);
P2 = abs(Y2/L); % 'normalize' amplitude spectrum by length of signal
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
freq = (F*1000)*(0:(L/2))/L;
amp2d=P1;
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化