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에서 PID Controller Tuning에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!