wildany
Mechanical
- Feb 6, 2015
- 2
Dear All,
I want to create FOR LOOP by Matlab to solve this equation :
x(t+dt)=(dt*A+I)*x(t)+B*dt
in which
A =[0 1;-6 -5]
I=eye(2)
B=[0;1]
dt=0.01
initial condition
x(0)=[0;0]
x(t) = vector 2x1
Any one can give me some ideas ?
I have created some scripts in m file as per below :
ft=1; % Step Input
dt=0.01; % Time Interval (can be changed)
t_end=5; % End of Time for plotting (fix)
Nstep=round(t_end/dt);
Xo=zeros(2,1); % Initial Condition for X, at t=0
Xdot0=A*Xo+B*ft; % Intitial Condition for Xdot, at t=0
Y=C*Xdot0; % Intitial Condition for Y, at t=0
I=eye(size(A)); % Identity Matrix
for i=1:Nstep
x(i)= Xo
x(i+1)=(dt*A+I)*x(i)+B*dt;
end
However, It does not work
Thanks a lot
Wildany
I want to create FOR LOOP by Matlab to solve this equation :
x(t+dt)=(dt*A+I)*x(t)+B*dt
in which
A =[0 1;-6 -5]
I=eye(2)
B=[0;1]
dt=0.01
initial condition
x(0)=[0;0]
x(t) = vector 2x1
Any one can give me some ideas ?
I have created some scripts in m file as per below :
ft=1; % Step Input
dt=0.01; % Time Interval (can be changed)
t_end=5; % End of Time for plotting (fix)
Nstep=round(t_end/dt);
Xo=zeros(2,1); % Initial Condition for X, at t=0
Xdot0=A*Xo+B*ft; % Intitial Condition for Xdot, at t=0
Y=C*Xdot0; % Intitial Condition for Y, at t=0
I=eye(size(A)); % Identity Matrix
for i=1:Nstep
x(i)= Xo
x(i+1)=(dt*A+I)*x(i)+B*dt;
end
However, It does not work
Thanks a lot
Wildany