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. my main problem is this term "uc0 = u[end end end end];" what is the correct way.
1 回表示 (過去 30 日間)
古いコメントを表示
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')
0 件のコメント
採用された回答
Torsten
2018 年 7 月 3 日
uc0 = u(end,:);
3 件のコメント
Stephen23
2018 年 7 月 6 日
@Dirar Aletan: rather than trying to pass so many individual variables, I would recommend that you define those values as fields of one structure. Then you just have one variable to pass around.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Web Services についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!