MATLAB: Hello, i want to set the final values of the first function with variable “u” as an initial values for the second function with variable “uc”, which can be shown below. the main problem is this term “uc0 = u[end end end end];” what is the correct w

final valueinitial value

close all; clc
kd = 10;
cd = 0.0051;
ct = 10.47;
Tt = 39.5671;
Jt = 13.92;
Jb = 1.1378;
WOB = 1760.9718;
Ls = 0.00597;
Lk = 0.0045;
Ld = 0.183;
Lstr = 0.000019312;
u0 = [0 0 0 0];
tspan = [0 45];
[t,u] = ode45(@(t,u) first_order2(u,kd,cd,ct,Tt,Jt,Jb,WOB,Ls,Lk,Ld,Lstr), tspan, u0);
plot(t,u(:,2),'r',t,u(:,4),'b')
figure
plot(u(:,3)-u(:,1),u(:,4),'g')
%CONTROL
uc0 = u[end end end end];
[tc,uc] = ode45(@(tc,uc) control(uc,kd,cd,ct,Tt,Jt,Jb,WOB,Ls,Lk,Ld,Lstr), tspan, uc0);
plot(t,uc(:,2),'r',t,uc(:,4),'b')
figure
plot(uc(:,3)-uc(:,1),uc(:,4),'g')

Best Answer

uc0 = u(end,:);
Related Question