Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear;
- N=100;
- for k = 1:N
- w(k) = 1*pi/N*k;
- H(k) = 1/3 * (1a+ exp(-j*w(k)) + exp(-j*2*w(k)));
- %H2(k) = 1/3 * (1+ exp(j*w(k)) + exp(j*2*w(k)))/exp(j*2*w(k));
- Habs(k) = (1+2*exp(-j*1.5*w(k))*cos(w(k)/2))/3;
- Pangle(k) = -1.5*j*w(k);
- end
- figure
- subplot (2,2,1)
- plot(w,abs(H))
- grid on
- title('Magnitude of Transfer function by Matlab');
- xlabel('w');
- ylabel('Magnitude');
- subplot (2,2,2)
- plot(w,angle(H))
- grid on
- title('Phase of Transfer function by Matlab');
- xlabel('w');
- ylabel('Phase');
- subplot (2,2,3)
- plot(w,Habs)
- grid on
- title('Magnitude of Transfer function by hand');
- xlabel('w');
- ylabel('Magnitude');
- subplot (2,2,4)
- plot(w,Pangle)
- grid on
- title('Phase of Transfer function by hand');
- xlabel('w');
- ylabel('Phase');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement