DTFT on for filter
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to find DTFT of h1 and h2 on MATLAB, but the graph and what I calculation is very different on h2. If anyone knows, please help me check
h1 = [.5 .5];
h2 = [0.5 -0.5];
omega = -4*pi:0.01:4*pi;
fz1 = freqz(h1,1,omega);
fz2 = freqz(h2,1,omega);
figure (7);
subplot(2,1,1);
plot(omega/pi, abs(fz1));
grid on
title('Magnitude response of h1[n]');
hold on
subplot(2,1,2);
plot(omega/pi,abs(fz2));
grid on
title('Magnitude response of h2[n]');
hold off
0 Kommentare
Antworten (1)
Paul
am 16 Feb. 2022
What exactly is not matching for h2? Did you do something different for h1? Looks like freqz returns the DTFT of h2 as it should. Well, at least the magnitude, I didn't check the phase.
h1 = [.5 .5];
h2 = [0.5 -0.5];
omega = -4*pi:0.01:4*pi;
fz1 = freqz(h1,1,omega);
fz2 = freqz(h2,1,omega);
figure;
subplot(2,1,1);
plot(omega/pi, abs(fz1));
grid on
title('Magnitude response of h1[n]');
subplot(2,1,2);
hold on
plot(omega/pi,abs(fz2));
grid on
title('Magnitude response of h2[n]');
plot(omega/pi,abs(h2(1)+h2(2)*exp(-1j*omega)),'ro','MarkerIndices',1:20:numel(omega))
hold off
2 Kommentare
Paul
am 16 Feb. 2022
The DTFT of h2 at omega = pi/2 is
h2 = [0.5 -0.5];
fz2 = h2(1) + h2(2)*exp(-1j*pi/2)
Its magnitude, which is what is being plotted using the abs() function, is
abs(fz2)
which is indeed 0.7071, and is shown on the plot above at the x-axis value of 1/2 (because the independent variable for those plots is omega/pi). Feel free to show the manual calculations if they are yielding a different result.
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!