How to increase the "linewidth" of given graphs?
3 次查看(过去 30 天)
显示 更早的评论
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)
T=stepinfo(T)
0 个评论
采纳的回答
Walter Roberson
2023-4-29
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)
T=stepinfo(T)
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 个评论
Walter Roberson
2023-4-29
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(:)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Title 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!