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!