clear all close all clc
A = [0 1;0 0]; B2 = [0; 64013000]; Cc = [-10.588174398921385 -0.318818010164237]; Bc = [2.409919108480979e3 ; 4.696699700129756e2]; C2 = [1 0]; Ac = [-2.409587000245264e3 1.000000016273038 ; -6.777812774681246e8 -2.040849728464332e7];
B1 = [0 0;1 0]; D21 = [0,1];
C1 = [1 0; 0 0]; D12 = [0; 0.1];
Acl = [A B2*Cc ; Bc*C2 Ac]; Bcl = [B1 ; Bc*D21]; Ccl = [C1 D12*Cc]; Dcl = zeros(2,2);
clsys = ss(Acl, Bcl, Ccl, Dcl);
t = 0:0.01:10; A = 1; f = 1000; q = A*sin(f*t);
z = lsim(clsys, q, t);
figure(1) plot (t, q(1,:),'b', t, z(:,1),'r')
figure(2) plot (t, z(:,2))
omega = logspace(-2, 4, 5000); [mag, phase] = bode(clsys,omega); mag1 = reshape(mag(1,1,:),1,5000); figure(3) semilogx(omega, 20*log10(mag1))
Does the problem lies with how I tried to generate my sin wave?
The error message was: "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"
Best Answer