How can I change the label after using my sim function
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Jialu Yao
am 15 Okt. 2023
Kommentiert: Jialu Yao
am 16 Okt. 2023
A = [0.9607, 0.0196, 0.1776; -0.0098, 0.9999, -0.0009; 0, 0, 0.8187];
B = [0.0185, 0.1974; -0.0001, 0.1390; 0.1813, 0];
C = [1, 0, 0; 0, 1, 0; 0, 0, 1];
Ts = 0.2;
sys = ss(A, B, C, 0, Ts);
% States : HP = Head Perturbation; SP = Stock-level Perturbation; AP = Air
% Valve Perturbation
% Controls: AV = Air Valve; SV = Stock Valve
model = setmpcsignals(sys,'MV',[1,2],'MO',[1,2,3]);
% controller object, sampling period, prediction hor., control hor.
mpcobj = mpc(model, Ts, 10, 10);
% Input constraints
mpcobj.MV(1,1).Min = -5;
mpcobj.MV(1,1).Max = 5;
mpcobj.MV(1,2).Min = -10;
mpcobj.MV(1,2).Max = 10;
% Output Constraints
mpcobj.OV(1,1).Min = 0;
mpcobj.OV(1,1).Max = 50;
mpcobj.OV(1,2).Min = 0;
mpcobj.OV(1,2).Max = 25;
Tstop = 30; % simulation time
Tf = round(Tstop/Ts); % number of simulation steps
r = 10*ones(Tf,3); % reference signal
sim(mpcobj,Tf,r)
This is my matlab code for MPC. After I use the sim function there are two graphs and I would like to change the label of them. If I use title, I can only change one of them. is there a way that I can directly change the titles without using several plot functions and regenerate my graphs?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 15 Okt. 2023
Verschoben: Walter Roberson
am 15 Okt. 2023
A = [0.9607, 0.0196, 0.1776; -0.0098, 0.9999, -0.0009; 0, 0, 0.8187];
B = [0.0185, 0.1974; -0.0001, 0.1390; 0.1813, 0];
C = [1, 0, 0; 0, 1, 0; 0, 0, 1];
Ts = 0.2;
sys = ss(A, B, C, 0, Ts);
% States : HP = Head Perturbation; SP = Stock-level Perturbation; AP = Air
% Valve Perturbation
% Controls: AV = Air Valve; SV = Stock Valve
model = setmpcsignals(sys,'MV',[1,2],'MO',[1,2,3]);
% controller object, sampling period, prediction hor., control hor.
mpcobj = mpc(model, Ts, 10, 10);
% Input constraints
mpcobj.MV(1,1).Min = -5;
mpcobj.MV(1,1).Max = 5;
mpcobj.MV(1,2).Min = -10;
mpcobj.MV(1,2).Max = 10;
% Output Constraints
mpcobj.OV(1,1).Min = 0;
mpcobj.OV(1,1).Max = 50;
mpcobj.OV(1,2).Min = 0;
mpcobj.OV(1,2).Max = 25;
Tstop = 30; % simulation time
Tf = round(Tstop/Ts); % number of simulation steps
r = 10*ones(Tf,3); % reference signal
sim(mpcobj,Tf,r)
figs = get(0,'Children');
T = findall(figs, 'string', 'Plant Outputs')
Tax = T.Parent
Tax.Tag
Tax.Title
Tax.HandleVisibility
In summary, the name Plant Outputs is a Title within a hidden axes. You can findall() it and then change its String property.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Fluid Dynamics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!