FFT for ideal filters
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Weird Rando
il 5 Giu 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 Commenti
Vedere anche
Categorie
Scopri di più su Digital Filter Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!