matlab加窗函数减少频谱泄露的问题
clc;clear all;
fs=2000;
dt=1./fs;
N=512;
n=0:1:N-1;
t=n*dt;
Wd=hamming(N);
f=n*fs./N;
s=2*cos(2*30*t);
sc=s.*Wd;
figure(1)
subplot(211)
plot(t,s)
subplot(212)
plot(t,sc)
s1=fft(s);
s2=fft(sc);
figure(2)
subplot(211)
plot(f-fs/2,abs());
axis([-400,400,0,500]);
subplot(212)
plot(f-fs/2,abs());
axis([-400,400,0,500]);
出现错误:
??? Error using ==> unknown
Matrix dimensions must agree.
Error in ==> Untitled at 22
sc=s.*Wd;
我是初学者。请问信号与窗函数是怎么乘的?是不是产生窗函数的方法错了?
谢谢!-%-40740-%- 恩,可以查找一下附有程序代码的文献,我用matlab写过这方面的程序,不难 0000xiexie
页:
[1]