用matlab 计算信号的频率图像。频谱绘画

因为采集上来的图像绘画是

想要进行滤波,但是又不知道数据里面都包含了哪些频率。只能用到傅里叶变换进行查看频谱了。

参考一下http://blog.sina.com.cn/s/blog_a07f4fe301013gj3.html参考。

t=0:1/256:1;%采样步长

y= 2+3*cos(2*pi*50*t-pi*30/180)+1.5*cos(2*pi*75*t+pi*90/180);

N=length(t); %样点个数

plot(t,y);

fs=256;%采样频率

df=fs/(N-1);%分辨率

f=(0:N-1)*df;%其中每点的频率

Y=fft(y(1:N))/N*2;%真实的幅值

%Y=fftshift(Y);

figure(2)

plot(f(1:N/2),abs(Y(1:N/2)));

恶补一下数学傅里知识https://blog.csdn.net/liezhuo/article/details/56288883

根据《生物医学数字信号处理》找到一个https://sourceforge.net/p/digiscope/code/HEAD/tarball?path=/trunk下载最新的版本软件。

用自己的数据画出来

t=load('D:/pinpushuju.xls');
N=length(t); %样点个数

plot(t,y);

fs=256;%采样频率

df=fs/(N-1);%分辨率

f=(0:N-1)*df;%其中每点的频率

Y=fft(y(1:N))/N*2;%真实的幅值

%Y=fftshift(Y);

figure(2)

plot(f(1:N/2),abs(Y(1:N/2)));

猜你喜欢

转载自blog.csdn.net/dongxinddd123/article/details/85764109