Question

Use MATLAB to plot a root locus and design a control system. 1. download and review the project file at root locus.ma Create

% MATLAB allows root loci to be plotted with the

% rlocus(GH) command, where G(s)H(s) = numgh/dengh and GH is an LTI transfer-

% function object. Points on the root locus can be selected interactively

% using [K,p] = rlocfind(GH) command. MATLAB yields gain(K) at

% that point as well as all other poles(p) that have that gain. We can zoom

% in and out of root locus by changing range of axis values using

% command axis([xmin,xmax,ymin,ymax]). root locus can be drawn

% over grid that shows constant damping ratio(z) and constant natural

% frequency(wn) curves using sgrid(z,wn) command. To plot multiple

% z and wn curves, use z = zmin:zstep:zmax and wn = wnmin:wnstep:wnmax to

% specify a range of values.

clf % Clear graph.

numgh insert yours; % Define numerator of G(s)H(s).

dengh= insert yours; % Define denominator of G(s)H(s).

'G(s)H(s)' % Display label.

GH=tf(numgh,dengh) % Create G(s)H(s) and display.

rlocus(GH) % Draw root locus.

z=0.2:0.05:0.5; % Define damping ratio values: 0.2 to

% 0.5in steps of 0.05.

wn=0:1:10; % Define natural frequency values: 0

% to 10 in steps of 1.

sgrid(z,wn) % Generate damping ratio and natural

% frequency grid lines for root

% locus.

title('Root Locus') % Define title for root locus.

'Hit Enter to Continue to Close-Up'

pause %Pause

rlocus(GH) % Draw close-up root locus.

axis([-3 1 -4 4]) % Define range on axes for root locus

% close-up view.

title('Close-up') % Define title for close-up root

% locus.

z=0.45; % Define damping ratio line for

% overlay on close-up root locus.

wn=0; % Suppress natural frequency overlay

% curves.

sgrid(z,wn) % Overlay damping ratio curve on

% close-up root locus.

for k=1:10 % Loop allows 10 points to be selected

% (z=0.45, jw crossing, breakaway)

[K,p]=rlocfind(GH) % Generate gain, K, and closed-loop

% poles, p, for point selected interactively on

% root locus.

end % End loop.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

% MATLAB allows root loci to be plotted with the

% rlocus(GH) command, where G(s)H(s) = numgh/dengh and GH is an LTI transfer-

% function object. Points on the root locus can be selected interactively

% using [K,p] = rlocfind(GH) command. MATLAB yields gain(K) at

% that point as well as all other poles(p) that have that gain. We can zoom

% in and out of root locus by changing range of axis values using

% command axis([xmin,xmax,ymin,ymax]). root locus can be drawn

% over grid that shows constant damping ratio(z) and constant natural

% frequency(wn) curves using sgrid(z,wn) command. To plot multiple

% z and wn curves, use z = zmin:zstep:zmax and wn = wnmin:wnstep:wnmax to

% specify a range of values.

clf % Clear graph.
numgh=[1,-4,20]; % Define numerator of G(s)H(s).
dengh=[1,6,8]; % Define denominator of G(s)H(s).
disp('G(s)H(s)'); % Display label.
GH=tf(numgh,dengh); % Create G(s)H(s) and display.
disp(GH);
rlocus(GH);
set(gca,'FontSize',20);% Draw root locus.
z=0.2:0.05:0.5; % Define damping ratio values: 0.2 to 0.5in steps of 0.05.
wn=0:1:10; % Define natural frequency values: 0 to 10 in steps of 1.
sgrid(z,wn) % Generate damping ratio and natural frequency grid lines for root locus.
title('Root Locus','FontSize',20); % Define title for root locus.
pause; %Pause
%%
figure;
rlocus(GH) % Draw close-up root locus.
axis([-3 1 -4 4]) % Define range on axes for root locus close-up view.
title('Close-up'), % Define title for close-up root locus.
z=0.45; % Define damping ratio line for overlay on close-up root locus.

wn=0; % Suppress natural frequency overlay curves.

sgrid(z,wn) % Overlay damping ratio curve on close-up root locus.

for k=1:10 % Loop allows 10 points to be selected

% (z=0.45, jw crossing, breakaway)

[K,p]=rlocfind(GH); % Generate gain, K, and closed-loop
disp(K)
% poles, p, for point selected interactively on

% root locus.

end % End loop.

Output:

Figure:1-Root Locus:

Root Locus 5 0.5 0.450.40.350.30.250.2 4 3 2 5 3 Imaginary Axis (seconds) -2 -3 0.5 0.450.40.350.30.250.2 56 -5 -4 -3 -2 0 1Figure-2: selected points and Gain:

Clup Imaginary Axis (seconds) Asal Auths (wide)

We found for zeta = 0.45, K= 0.417

Add a comment
Know the answer?
Add Answer to:
% MATLAB allows root loci to be plotted with the % rlocus(GH) command, where G(s)H(s) =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT