How can I change the label after using my sim function
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Jialu Yao
il 15 Ott 2023
Commentato: Jialu Yao
il 16 Ott 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 Commenti
Risposta accettata
Walter Roberson
il 15 Ott 2023
Spostato: Walter Roberson
il 15 Ott 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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Fluid Dynamics in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!