Legend/Label in a compare command of an identified mimo system
1 view (last 30 days)
Show older comments
Dear Matlab community
I am facing the following problem. I estimated an MIMO modell by ssest. Now, I want to compare the data with the identified systems by the compare command. I've already tried several ways but ususally only the label for the first output or all of the outputs or a default label is displayed. See the code below.
For example:
%%first trial
data = iddata(y,u,Ts);
sys_ord2 = ssest(data,2,'Ts',Ts,'InputName',['Mast Moment','Thrust','Density'],'OutputName',['Omega','Rotor Force x','Rotor Force y','Rotor Force z', ...
'Rotor Moment x', 'Rotor Moment y', 'Rotor Moment z']);
%second trial
data = iddata(y,u,Ts, 'Name', ['Omega','Rotor Force x','Rotor Force y','Rotor Force z', ...
'Rotor Moment x', 'Rotor Moment y', 'Rotor Moment z']);
sys_ord2 = ssest(data,2,'Ts',Ts);
%third trial
data = iddata(y,u,Ts,'Name','Omega','Name','Rotor Force x','Name','Rotor Force y','Name','Rotor Force z', ...
'Name','Rotor Moment x','Name','Rotor Moment y','Name','Rotor Moment z']);
sys_ord2 = ssest(data,2,'Ts',Ts);
%fourth trial
data = iddata(y,u,Ts);
data.InputData = {'Mast Moment','Thrust','Density'};
data.OutputData = {'Omega','Rotor Force x','Rotor Force y','Rotor Force z', ...
'Rotor Moment x', 'Rotor Moment y', 'Rotor Moment z'};
sys_ord2 = ssest(data,2,'Ts',Ts);
1 Comment
Arun
on 27 Oct 2023
Could you please provide more clearity about what is the output you get after compare function and what is that you seek as output?
Answers (1)
Balavignesh
on 15 Jan 2024
Hi Benjamin,
As per my understanding, you are facing an issue with labeling the outputs when comparing the measured data with the identified system, and you are looking to correctly display the labels for each output in the comparison plots.
The 'iddata' object is used to store time-domain input-output data, and the 'ssest' function is used state-space models from this data. When you're using the compare function to compare the measured output with the simulated output of an identified model, MATLAB should automatically use the output names from the iddata object or the model if they have been set.
I think there are some issues with how you're trying to set the 'InputName' and 'OutputName' properties. Have a look at the following code snippet to rectify the issue:
% Assuming y is the output data matrix, u is the input data matrix, and Ts is the sampling time
% Create the iddata object with named inputs and outputs
data = iddata(y, u, Ts, ...
'InputName', {'Mast Moment', 'Thrust', 'Density'}, ...
'OutputName', {'Omega', 'Rotor Force x', 'Rotor Force y', 'Rotor Force z', ...
'Rotor Moment x', 'Rotor Moment y', 'Rotor Moment z'});
% Estimate the state-space model
sys_ord2 = ssest(data, 2, 'Ts', Ts);
% Compare the measured and simulated outputs using the compare command
compare(data, sys_ord2);
Kindly refer to the following documentation links to have more information on:
- 'iddata' object: https://www.mathworks.com/help/ident/ref/iddata.html
- 'ssest' function: https://www.mathworks.com/help/ident/ref/ssest.html
- 'compare' function: https://www.mathworks.com/help/ident/ref/compare.html
Hope that helps!
Balavignesh
0 Comments
See Also
Categories
Find more on Transfer Function Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!