求Matlab大神,问下fft做完以后如何写代码求得对应某个频率的幅值?
这是小弟的代码,谁能帮我改一下,输出52k频率信号的幅值,谢谢了。functiondc=myfft(signal,fs,len,caption)iflen==0N=len...
这是小弟的代码,谁能帮我改一下,输出52k频率信号的幅值,谢谢了。function dc = myfft(signal, fs, len, caption)if len == 0N = length(signal);elseN = len;endN;ts = 1/fs;data = signal(1:N);S = fft(data,N);CS = fftshift(S);freq = ([-N/2: N/2-1] + 1/2)/(N*ts);mag = abs(CS) /(N/2);magS = abs(S) / (N/2);dc = magS(2);figure;plot(freq/1e3,mag);set(gca, 'LineWidth', 1.5 ); set(gca, 'TickLength',[0.005 0.0025]);set(gca, 'FontSize', 10);set(gca, 'FontWeight', 'bold');box ontitle(caption, 'FontSize', 14, 'FontWeight', 'bold');xlabel('Freq. /kHz', 'FontSize', 12);ylabel('Mag. /fd ', 'FontSize',12);end
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询