Can someone please help me with this matlab code. My a = 1, b = 5, c =9, d=3 PRO
ID: 2250226 • Letter: C
Question
Can someone please help me with this matlab code.
My a = 1, b = 5, c =9, d=3
Explanation / Answer
"Please check for poles and zeros locations once again."
%Practice problem
clear all;clc
t=[0:0.01:1]; % time of simulation run and sampling
K = (729/26)*1e6; % K in standard form
Z = [-1 (-1+5i) (-1-5i)]; % zeros for the given transfer function
P = [-90 -90 -300 -300]; % poles for the given transfer function
G = zpk(Z,P,K); % Transfer function of system
H_imp = impulse(G,t); % Impulse response for given system
figure
plot(t,H_imp) % impulse response plot
Imp_info = lsiminfo(H_imp,t); % Impulse response information
H_step = step(G,t) % Step response for given system
figure
plot(t,H_step) % plot for step response
Step_info = stepinfo(H_step,t) % step response information
[U,T] = gensig('square',2,20,0.1) % generating square waveform
Y_square = lsim(G,U,T) % System response with square waveform
figure
plot(T,Y_square) % plot response graph for Square input
Ysquare_info = lsiminfo(Y_square,T) % System info with square waveform
[MAG,Phase]=bode(G,{1e-1 5e5}); % bode plot
figure
bodeplot(G)
figure
pzmap(G) % pole-zero plot