Effacer les filtres
Effacer les filtres

How to increase the "linewidth" of given graphs?

3 vues (au cours des 30 derniers jours)
Sadiq
Sadiq le 29 Avr 2023
Commenté : Sadiq le 30 Avr 2023
I want to increase the linewidth of the following two graphs? But how? The required mat file is hereby attached and the code is given below:
clear;clc;
s=tf('s');
G=(61.73*s^2+2.112e4)/(s^4+52.42*s^3+967.1*s^2+1.793e4*s);
%%%%%%%%%%%%%%
% Contrioller
%%%%%%%%%%%%%%
load PIDGains.mat
[one1 ind]=sort(one,'descend');
[fitness,ind1]=min(one1);
two1=two(ind1,:);
Kp=two1(1);
Ki=two1(2);
Kd=two1(3);
Gc=Kp+Ki/s+Kd*s;
%%%%%%%%%%%%%%%
% Feedback TF
%%%%%%%%%%%%%%
H=1;
%%%%%%%%%%%%%%
% Closed Loop TF
%%%%%%%%%%%%%%
T=feedback(Gc*G*H,1);
%%%%%%%%%%%%%%%%%%
% Step Response of open loop and closed loops
%%%%%%%%%%%%%%%%%%
subplot(2,1,1)
step(G)
subplot(2,1,2)
step(T)
G=stepinfo(G)
G = struct with fields:
RiseTime: NaN TransientTime: NaN SettlingTime: NaN SettlingMin: NaN SettlingMax: NaN Overshoot: NaN Undershoot: NaN Peak: Inf PeakTime: Inf
T=stepinfo(T)
T = struct with fields:
RiseTime: 7.1553e-05 TransientTime: 1.2930e-04 SettlingTime: 1.2930e-04 SettlingMin: 0.9030 SettlingMax: 0.9977 Overshoot: 0 Undershoot: 0 Peak: 0.9977 PeakTime: 2.3684e-04

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Avr 2023
clear;clc;
s=tf('s');
G=(61.73*s^2+2.112e4)/(s^4+52.42*s^3+967.1*s^2+1.793e4*s);
%%%%%%%%%%%%%%
% Contrioller
%%%%%%%%%%%%%%
load PIDGains.mat
[one1 ind]=sort(one,'descend');
[fitness,ind1]=min(one1);
two1=two(ind1,:);
Kp=two1(1);
Ki=two1(2);
Kd=two1(3);
Gc=Kp+Ki/s+Kd*s;
%%%%%%%%%%%%%%%
% Feedback TF
%%%%%%%%%%%%%%
H=1;
%%%%%%%%%%%%%%
% Closed Loop TF
%%%%%%%%%%%%%%
T=feedback(Gc*G*H,1);
%%%%%%%%%%%%%%%%%%
% Step Response of open loop and closed loops
%%%%%%%%%%%%%%%%%%
ax1 = subplot(2,1,1);
step(G)
ax2 = subplot(2,1,2);
step(T)
G=stepinfo(G)
G = struct with fields:
RiseTime: NaN TransientTime: NaN SettlingTime: NaN SettlingMin: NaN SettlingMax: NaN Overshoot: NaN Undershoot: NaN Peak: Inf PeakTime: Inf
T=stepinfo(T)
T = struct with fields:
RiseTime: 7.1553e-05 TransientTime: 1.2930e-04 SettlingTime: 1.2930e-04 SettlingMin: 0.9030 SettlingMax: 0.9977 Overshoot: 0 Undershoot: 0 Peak: 0.9977 PeakTime: 2.3684e-04
set(ax1.Children(1).Children(1), 'LineWidth', 3, 'Color', 'g')
set(ax2.Children(1).Children(2), 'LineWidth', 3, 'Color', 'r')
That is, when you do step() inside a subplot, then a Group object is created, that has 2 line objects as children. The second of the two line objects is the step response. The fact that nothing showed up in green shows that (at least for this purpose) the first line object is nothing of interest.
(You do not need to set the color; I do it here just to emphasize which object has been affected (or not affected.)
  4 commentaires
Walter Roberson
Walter Roberson le 29 Avr 2023
The purpose of the code is to illustrate that the second location Children(1).Children(2) is the item to set and that Children(1).Children(1) will not work. Without this test people might tend to think that they could just set the line width of both lines Children(1).Children(:)
Sadiq
Sadiq le 30 Avr 2023
Thanks a lot dear Walter Roberson for your kind response. Yes, it works now.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by