phase jumps in dtft
Mostrar comentarios más antiguos
hey what causes the phase jumps in angle plot? whats the problem ? its not like that theorically it just happens in matlab

this is the code:
% Plotting the spectrum of a discrete-time rectangular pulse
n=-20:20;
w=-2.5*pi:.01:2.5*pi;
x1=zeros(size(n));
x1(n>=-2 & n<=2)=1;
% x1(19:23)=1;
X=dtft(n,x1,w);
subplot(3,1,1)
stem(n,x1,'linewidth',3);
set(gca,'fontsize',24)
axis([-20 20 0 1.2])
xlabel('n')
ylabel('x[n]')
subplot(3,1,2)
plot(w/pi,abs(X),'linewidth',3);
set(gca,'fontsize',24)
xlabel('\omega (\times\pi rad)')
ylabel('|X(e^{j\omega})|')
subplot(3,1,3)
plot(w/pi,angle(X),'linewidth',1);
set(gca,'fontsize',24)
xlabel('\omega (\times\pi rad)')
ylabel('\angle X(e^{j\omega})')
Respuestas (1)
n=-20:20;
w=-2.5*pi:.01:2.5*pi;
x1=zeros(size(n));
x1(n>=-2 & n<=2)=1;
% x1(19:23)=1;
Matlab doesn't have a function dtft.
which -all dtft
try
X=dtft(n,x1,w);
catch ME
ME.message
end
Here's one way to generate the DTFT over the frequency range
X = freqz(x1,1,w).*exp(-1j*w*n(1));
Yes, the angle jumps around.
subplot(211);
plot(w,abs(X))
subplot(212);
plot(w,angle(X))
That's because the DTFT as computed by freqz returns very, very, very small imaginary part, presumably due to round off, which causes the phase to be either very close to zero, very close to pi, over very close to -pi
figure
subplot(211),plot(w,real(X))
subplot(212),plot(w,imag(X))
Categorías
Más información sobre Spectral Measurements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

