필터 지우기
필터 지우기

How to increase the "linewidth" of given graphs?

조회 수: 3 (최근 30일)
Sadiq
Sadiq 2023년 4월 29일
댓글: Sadiq 2023년 4월 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)
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

채택된 답변

Walter Roberson
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)
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
Walter Roberson
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(:)
Sadiq
Sadiq 2023년 4월 30일
Thanks a lot dear Walter Roberson for your kind response. Yes, it works now.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 PID Controller Tuning에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by