Signals and systems I need help in matlab coding to generate
Signals and systems
I need help in matlab coding to generate magnitude and phase response by only using system function H(z) rather than express the system function H(z) into magnitude and phase response first.
Solution
MATLAB CODE :
clc;
 clear all;
 w=-pi:0.01:pi; % frequency vector
 z=exp(1j*w); % z - domain variable
 H1=zeros(1,length(w)); % initialization of filter response
 N=3; % No. of samples
 for n=0:N;
 H1=H1+z.^(-n); % filter equation H(z)=1+z^-1 +z^-2 +.......+z^-N
 end   
 H=H1/(N+1);
 subplot(211);
 plot(w,abs(H));
 xlabel(\'frequency W\');
 ylabel(\'Amplitude\');
 title(\'Magnitude Response\');
 subplot(212);
 plot(w,angle(H));
 xlabel(\'frequency W\');
 ylabel(\'Phase\');
 title(\'Phase Response\');

