我目前正在对matlab中的某些信号进行频谱分析,我应该使用Hamming窗口函数(https://www.mathworks.com/help/signal/ref/hamming.html)进一步分析相同的信号但是我我遇到了一些不寻常的问题,当我使用内置函数hamming(L)时得到错误的结果,当我自己编写函数时,得到正确的结果,就像在MATLAB中定义一样.这是代码:
%This is a signal i am analyzing and it has N points.
F1 = 55/450;
F2 = 67/450;
N = 450;
n = 0:(N-1);
x = 50*cos(2*pi*F1*n)+100*cos(2*pi*F2*n)
% Here is the code for plotting the signal in N points
figure
n = 0:(N-1);
stem(n,x);
xlabel('n');
ylabel('x[n]');
title('Discrete Signal x[n]');
pause
% Here i am using a built in function. It is of length N, the same as x[n].
n=0:(N-1);
window1 = hamming(N);
figure
y1 = x.*window1; %The …Run Code Online (Sandbox Code Playgroud)