

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


%% transfer functions %% %%%%%%%%%%%%%%%%%%%%%%%% numG = 3; denG = [1,2,5,0]; G = tf(numG,denG) % specify G by coeff of its num & den polynomials G_factored = zpk(G) % returns G in factored form (s+z1)(..)/(s+p1)(...) numG = 2500; denG = conv([1,15],[1,10,100]); % specify polynomial by its factors G = tf(numG,denG); G_factored = zpk(G) G = zpk([],[-1,-2,-2],2) % specify G by its zeros/poles/gain numG = 2; denG = poly([-1,-2,-2]); % specify polynomial by its zeros G = tf(numG,denG) numG = [1,4,5]; denG = conv([1 2 5],poly([-3,-4])); % a mix of the conv & poly commands to specify G G = tf(numG,denG); G_factored = zpk(G) syms s % treat s as a symbolic variable and not a number s = tf('s'); % treat s as the Laplace variable H = 1/(s^3 + 5s^2 + 8s + 4) % specify G as a ratio of polynomials in Laplace variable s zero(G) % gives zeros of G pole(G) % gives poles of G %%%%%%%%%%%%%%%%%%%%%%%%%% %% time domain analysis %% %%%%%%%%%%%%%%%%%%%%%%%%%% step(G) % step response of G t_range = 0 : 0.01 : 10; step(G,t_range) % step response over time interval specified by t_range step(G,H) % compare the step responses of G and H StStGain = dcgain(G) % to compute steady-state gain [K,p] = residue(numG,denG) % gives coeff of partial frac exp & corresp poles syms s g = ilaplace(3/(s(s^2 + 2s + 5))) % inverse laplace pretty(g) % beautifies the time domain expression %%%%%%%%%%%%%%%%%%%%%% %% interconnections %% %%%%%%%%%%%%%%%%%%%%%% numH = 1; denH = [1,0]; H = tf(numH,denH) GH = series(G,H) % series interconnection of G and H GH = G*H % another way to find series connection of G and H G_plus_H = parallel(G,H) % parallel interconnection of G and H G_plus_H = G+H % another way to find parallel interconnection of G and H H_cl = feedback(H,1) % unity feedback of H G_cl = feedback(G,H) % feedback of G and H