Simulating linear model, can't understand error
Afficher commentaires plus anciens
I have a linear system called "ss" identified using "velocity", "position", and "time_sec_" vectors imported from a CSV file.
Used time interval of 0.02, delay of 0.4, included disturbance.

The 3rd order system looks like this:
>> [A,B,C,D,K,x0,dA,dB,dC,dD,dx0] = idssdata(ss)
A =
-0.2101 -3.0985 -0.8638
2.5007 -4.9519 -11.9558
0.1966 0.4627 8.4746
B =
0.0056
-0.0048
-0.0562
C =
31.8116 -0.8537 0.0245
D =
0
K =
1.3349
-32.7004
40.9704
x0 =
-0.0165
-0.0724
0.0023
dA =
1.0e+14 *
1.2124 0.1556 0.1185
2.6893 1.5376 1.1212
2.1587 1.5017 1.2671
dB =
1.0e+11 *
0.2318
4.1463
5.7636
dC =
1.0e+14 *
1.0754 0.0817 0.0737
dD =
0
dx0 =
1.0e+14 *
0.0877
1.6986
2.8014
I want to simulate the system. It's SISO (velocity -> position) but because it's third order I have to duplicate the velocity three times, one for each system state variable.
U = velocity * ones(1, 3)
Here is what I am calling lsim with:
>> size(U)
ans =
2415 3
>> size(time_sec_)
ans =
2415 1
I attempt to simulate the system:
lsim(ss, U, time_sec_)
Matlab returns the following error:
Error using DynamicSystem/lsim
When simulating the response to a specific input signal, the input
data U must be a matrix with as many rows as samples in the time
vector T, and as many columns as input channels.
This error message doesn't make sense because:
- U has as many rows as time samples in time_sec_ vector
- U has as many columns as rows in "B" matrix in the model (third order model, B has 3 rows)
- time_sec_ vector has one row for each time sample
- Time samples are absolute values increasing in time, in seconds
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Get Started with Control System Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!