if true % code
switch escase 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;endm=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!
Best Answer