I am trying to plot the following :
Im{X (e^jω)} = -a * sin(w) / (1 - 2*a*cos(w) + a^2) , where -1 < a < 0.
I am trying to plot it as a function of w. but for some reason I get only the line with 0 dots all along the y axes without any meaningful graph.
What is the best way to plot this function using Matlab?
Also how to properly plot a phase response if my response looks like this:
phase (X (ejω)) = tan^-1(-asin(w)/ 1 - acos(w)).
When I use angle() function the matlab throws error that X must be same length as Y. I am wondering if I do have to use functions such as imag() and angle() or just stem it without it. Currently my code is as follows:
a = -0.2;
N = 10;
w = -2*pi:2*pi/N:2*pi;
x_imag = - a.* sin(w)./(1 - 2 * a*cos(w) + a^2);
stem(w, imag(x_imag), 'filled')
x_phase = inv(tan(-a.*sin(w)./(1- a.*cos(w))))
stem(w, angle(x_phase), 'filled')
Where do I have a mistake?