I don't understand where the problem is in this system
1 view (last 30 days)
Show older comments
if true
% code
switch es
case 1, beta=0.1; k=2; x0=[0;0]; w0=0; tmax=20;
case 2, beta=0.01; k=2; x0=[0;0]; w0=0; tmax=200;
case 3, beta=10; k=20; x0=[0;0]; w0=0; tmax=10;
case 4, beta=0.1; k=2; x0=[0;0.2]; w0=0; tmax=20;
case 5, beta=0.1; k=2; x0=[0;0]; w0=4; tmax=10;
case 6, beta=0.01; k=2; x0=[0;0]; w0=4; tmax=10;
case 7, beta=10; k=20; x0=[0;0]; w0=4; tmax=10;
case 8, beta=0.1; k=2; x0=[0;0.2]; w0=4; tmax=10;
end
m=0.2;
f0=1;
A=[0,-k/m; 1,-k/beta];
B=[1/m,0;0,0];
C=[1,0];
D=0;
sistema=ss(A,B,C,D);
T=0:0.01:tmax;
U=f0*cos(w0*T);
[y,tsim,x]=lsim(sistema,U,T,x0);
end
The error is: Error using DynamicSystem/lsim (line 84) 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.
Thanks to all!
0 Comments
Accepted Answer
Jan
on 26 Mar 2017
Edited: Jan
on 26 Mar 2017
The message seems to be clear:
U must be a matrix with as many rows as samples in the time vector T,
and as many columns as input channels.
We cannot run your code, e.g. because "k" is undefined. But is looks like U and T have the same number of elements. Then it might be the number of input channels. Did you test this already?
2 Comments
Jan
on 26 Mar 2017
Sorry, I've overseen "k". A search in the net or in this forum is always a good idea. See e.g.:
Does D=0 mean, that the system has no input and output channels? I'm not familiar with Simulink, therefore I assume others might post more useful answers.
More Answers (0)
See Also
Categories
Find more on Transmitters and Receivers 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!