load('路径\文件名.txt')
signal=文件名;
fft_signal = fft(signal);
power_spectrum_signal = abs(fft_signal^2)/length(signal);
plot(power_spectrum_signal);
创建一个.m文件,把上面的程序复制到m文件里,然后修改路径和文件名就可以了。还不懂就发消息给我,我把程序传给你
绘制信号波形:
t = 0:0.001:0.6;
x = sin(2*pi*50*t)+sin(2*pi*120*t);
y = x + 2*randn(size(t));
plot(1000*t(1:50),y(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('time (milliseconds)')
绘制信号功率谱:
Pyy = Y.* conj(Y) / 512;
f = 1000*(0:256)/512;
plot(f,Pyy(1:257))
title('Frequency content of y')
xlabel('frequency (Hz)')
http://hi.baidu.com/zhjstef/blog/item/a35c1a4b16d6ad2409f7ef9e.html
这里有