FFT for ideal filters
4 views (last 30 days)
Show older comments
Hello everyone,
i have to plot impulse responses for some ideal filters (see the picture)
(lowpass highpass bandpass bandstop)
i was able to plot the lowpass one using this code :
if true
t=-5:.01:5;
x=rectpuls(t,2*0.2);
figure(1)
plot(t,x)
grid
Ts = mean(diff(t));
Fs = 1/Ts;
L = length(x);
ftx = fft(x)/L;
ftxs = fftshift(ftx);
Fv = linspace(-Fn, Fn, L);
figure(2)
plot(Fv, abs(ftxs))
grid
end
Now i want to do the rest, how can i do it ? thanks you !
0 Comments
Answers (1)
Weird Rando
on 5 Jun 2016
You do realise that the diagram you uploaded is the impulse responses for the ideal filters.
All you need to do is create an array with 1's and 0's at certain points of a and b.
freq = -.5:0.01:.5;
%high pass
b = 0.2;
hp = ones(1,length(freq));
hp(abs(freq)<0.2) = 0;
plot(freq,hp);
%axis([-0.6 0.6 -1 2]);
xlabel('Frequency')
ylabel('Magnitude')
0 Comments
See Also
Categories
Find more on Digital Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!