Clear Filters
Clear Filters

Identifying parameters in state space model misinterprets I/O count

2 views (last 30 days)
I'm trying to take some collected data, and fit it into a structured state space model, fixing some of the parameters and allowing the others to be estimated by MATLAB. I'm using for data vectors to do this. Three 610x1 doubles for output, and One 610x1 double for input.
% Setup Parameter Matrices
V = 1.00;
L1 = 0.255;
L2 = 0.845;
A = [0, V, (V*L1)/(L1+L2);
0, 0, V/(L1+L2);
0, 0, 0];
B = [ 0;
1 ];
C = [ 1, 1, 1];
D = 0;
K = [ 0; 0; 0 ];
% Some elements are fixed elements
mp = idss(A,B,C,D,K);
mp.Structure.A.Free = (A~=0);
mp.Structure.B.Free = 0;
mp.Structure.C.Free = 0;
mp.Structure.K.Free = 0;
% Create iddata, is my formatting here where I'm causing an error?
robot = iddata([XTE_d PSI_d Delta_d],[u_d],0.1);
robot.InputName = 'Steer Cmd';
robot.OutputName = {'XTE' 'PSI' 'Delta'};
robot.InputUnit = {'deg/S'};
robot.OutputUnit = {'Meters' 'Deg' 'Deg'}
robot.Tstart = 0;
robot.TimeUnit = 's';
mp = ssest(robot,mp)
Error using ssest (line 132)
The number of inputs and outputs of the model must match that of the data.
So by running it:
Error in readAndPlot (line 83)
mp = ssest(robot,mp)
As far as I can tell my iddata object is correct.
robot =
Time domain data set with 610 samples.
Sample time: 0.1 seconds
Outputs Unit (if specified)
XTE Meters
Delta Deg
Inputs Unit (if specified)
Steer Cmd deg/S
3 outputs and 1 input - yeah?
I found a similar question here: Question
And an example I'm following is here: Estimate Structured Discrete-Time State-Space Models
What's happening? Running
mp = ssest(robot(1:305),3,'Ts',0.1);
Seems to work just fine. Why can't I pass in an idss object successfully?

Answers (0)


Find more on Linear Model Identification 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!