Remove the negative frequency components of the signal.
7 次查看(过去 30 天)
显示 更早的评论
I want to remove the negative component of the signal(from -500 to 0) to make the negative half of the fft a flat line of 0 from -500 to 0 .
Fs=1000;
Ts=1/Fs;
t=0:Ts:10-Ts;
f1=50;f2=100;
y=2*cos(2*pi*t*f1)+ 4*cos(2*pi*t*f2);
N=length(y);
F=fft(y);
fr=(-N/2:N/2-1)*Fs/(N);
figure, plot(fr,abs(F))
xlabel(' frequency Hz')
0 个评论
回答(1 个)
Walter Roberson
2021-10-29
Fs=1000;
Ts=1/Fs;
t=0:Ts:10-Ts;
f1=50;f2=100;
y=2*cos(2*pi*t*f1)+ 4*cos(2*pi*t*f2);
N=length(y);
F=fft(y);
Fsh = fftshift(F);
Fsh(1:floor(end/2)) = 0;
fr=(-N/2:N/2-1)*Fs/(N);
figure, plot(fr,abs(Fsh))
xlabel(' frequency Hz')
YL = ylim();
ylim([-1000 YL(2)]);
2 个评论
Walter Roberson
2021-10-30
Fs=1000;
Ts=1/Fs;
t=0:Ts:10-Ts;
f1=50;f2=100;
y=2*cos(2*pi*t*f1)+ 4*cos(2*pi*t*f2);
N=length(y);
F=fft(y);
Fsh = abs(fftshift(F));
Fsh(1:floor(end/2)) = 0;
Fsh = Fsh - max(Fsh);
fr=(-N/2:N/2-1)*Fs/(N);
figure, plot(fr,Fsh)
xlabel(' frequency Hz')
YL = ylim();
low = min(Fsh) * 1.1;
ylim([low, 1000])
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!