Applying low pass filter in frequency domain
Afficher commentaires plus anciens
Hi.
I have a signal x(t) with white noise.
Then I have to apply low pass filter in frequency domain and observe the result in time domain.
So I coded this way.
- Calculate X = Fourier transform of x(t)
- Let low pass filter(H) be rectangularPulse with cut-off frequency
- Apply the low pass filter to X -> Y=HX in frequency domain.
- To observe the result in time domain, applying ifft(Y)
I attach code below.
fs=4; %sampling frequency
t=0:1/fs:256; % time domain
f=linspace(-pi,pi,length(t)); % frequency domain
N=0+0.2*rand(length(t),1); %white noise
x=2*cos(2*pi/12*t).*exp(-((t-90).^2)/35/35) + 1.5*cos(2*pi/6*t+pi/6).*exp(-((t-130).^2)/35/35)+1*cos(2*pi/4*t+pi/3).*exp(-((t-170).^2)/35/35)+N.'; %signal
X=fftshift(fft(x))/length(t); %Fourier transform of the signal
H=rectangularPulse(-0.13,0.13,f); %low pass filter with cut off frequency=0.13
Y=X.*H; %apply low pass filter to X in frequency domain
a=ifftshift(ifft(Y)); %inverse Fourier transform of Y to observe the result in time domain
My question is
- Is my approch correct?
- I confused about the scale factor. If I apply ifft, what is the scale factor? For example, in fft case, we have to divide fft withe the number of points to gain 'amplitude'.
- I know the difference between fft and ifft in theory, but in matlab, what is difference between fft and ifft? Because of duality of Fourer transform, I think the resualt fft and ifft is the same.
- By convolution theory, ifft(Y) is the same with conv(ifft(H),x), but it is not. Why??
Thank you for reading my questions.
3 commentaires
Shashank Raj
le 22 Oct 2021
'rectangular pulse' requires Symbolic math toolbox
I am getting this error, can someone please help me how to fix this?
Star Strider
le 22 Oct 2021
Arjun Mehra
le 15 Avr 2022
you have to add signal processing toolbox in your matlab
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Digital Filtering dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!