Hello I have a problem. I have a power train system, as an input I have torque with a constant slope and afte 0.4 seconds i need a constant torque. I realized it with a loop and if conditions. It doesn't work and I don't understand how to change my Code that there won't be an Error anymore.
This is the ERROR:
Error using DynamicSystem/lsim (line 84)In time response commands, the time vector must be real, finite, andmust contain monotonically increasing and evenly spaced time samples.Error in Antriebsstrang_Schmitt (line 99) [y,t,x]=lsim(sys,h1,t);
THIS IS MY CODE:
% Antriebsstrang : Zustandsdarstellung
clearclcclose all% System-Parameter
J4 = 0.0784; J2 = 0.000385; J1 = 0.000271; iG = 3.2; iA = 4.1; JM = 0.1322; % Motor, ...
cK = 1000; MM = 90; JA = J4+iA*iA*J2+iG*iA*iA*iA+J1 % Achswelle, ...
cA = 7300; JF = 0.3426; % RAd, ...
JR = 1.0457; % Reifen, ...
cR = 31600;% Systemmatrizen
J = [ JM 0 0 0;... 0 JA 0 0;... 0 0 JF 0;... 0 0 0 JR]; C = [cK (-cK*iG*iA) 0 0;... (-iG*iA*cK) (-cK*iG*iG*iA*iA+cA) -cA 0;... 0 -cA cA+cR -cR;... 0 0 -cR cR];% Lastverteilungsvektoren
p1 = [ 1;... 0;... 0;... 0 ]; % zu MM
% Matritzen für System- und Ausgangsgleichung & Modellaufbau
A = [ zeros(4,4) eye(4) ;... -inv(J)*C -inv(J)*zeros(4,4) ] B = [ zeros(4,1) ;... inv(J)*p1 ] Ca = [ 0 0 0 0 0 0 0 1 ] % phiR'
% phiM' phiM phiA' phiA phiF' phiF phiR' phiR
Da = [ 0 ]%Loop and If-
for x=0:0.003:1.6; if x< 0.4 t=datevec(x); h1= 200*t ; else h1= 80; h1=datevec(h1); end hold on sys = ss(A, B, Ca, Da) figure (1) hold on bode(sys) %LSIM
[y,t,x]=lsim(sys,h1,t); end figure(2) %Ausgabe nach Anregung
figure (2)plot(t, y);xlabel('Zeit [s]');ylabel('Beschleunigung [m/s^2]');title('Beschleunigung')
Best Answer