Remove the negative frequency components of the signal.
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Walter Roberson
le 29 Oct 2021
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 commentaires
Walter Roberson
le 30 Oct 2021
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])
Voir également
Catégories
En savoir plus sur Multirate Signal Processing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!