Exp6 M
Exp6 M
w=-1*pi:pi/512:1*pi;
z=input("Zeros:");
p=input("Poles:");
[NUM,DEN] = zp2tf(z,p,1);
h=freqz(NUM,DEN,w);
subplot(2,2,1);
zplane(z,p);
subplot(2,2,2);
plot(w/pi,20*log10(abs(h)));
title("magnitude spectrum of H(e^{j*omega})|(EC23B1003)");
xlabel("Omega/pi");ylabel("Amplitude");grid on;
subplot(2,2,3);
plot(w/pi,angle(h));
title("Phase spectrum of arg[H(e^{j*omega})](EC23B1003)");
xlabel("Omega/pi");ylabel("Phase (in radians)");grid on;
subplot(2,2,4);
[g1,t1]=impz(NUM,DEN,10);
stem(t1,g1);
title('impulse response(EC23B1003)');
xlabel("Time");ylabel("Amplitude");
%type1
% z=[0.5*exp(1j*pi/4);0.5*exp(-1j*pi/4);2*exp(1j*pi/4);2*exp(-1j*pi/4);];
% z=[-1;-1;1;1];
% p=[0;0;0;0];
%type2
% z=[exp(1j*pi/4);exp(-1j*pi/4);-1;2;0.5];
% z=[-1;-1;-1;1;1];
% p=[0;0;0;0;0];
% type3
% z=[exp(1j*pi/4);exp(-1j*pi/4);-1;1]
% z=[-1;1;2;0.5];
% p=[0;0;0;0];
%type4
% z=[exp(1j*pi/4);exp(-1j*pi/4);1;2;0.5];
% z=[-1;-1;1;1;1];
% p=[0;0;0;0;0];