[問題] 解ODE的問題!!已回收
版上的高手可以幫我看一下那裡有錯嗎??
跑不出來呀XD
用ode23可以解嗎??
function controller
[t x] = ode23(@controller1,[0 5],[0 1 1])
plot(t,x)
function dx = controller1(t,x)
global k m R L
k = 0.000378;
m = 0.0793;
R = 1;
L = 0.12829;
u1 = (3*x(1)+x(1)*x(2)^2+2*x(3))*x(2);
u2 = (x(1)^2*x(2)+2*x(2)+2*x(3))* -(k/m)*(x(3)^2/x(1)^2);
u3 = (2*x(1)+4*x(3)+2*x(2))*-(R/L)* x(3);
b = (2*x(1)+4*x(3)+2*x(2))*(1/L);
a = u1+u2+u3;
u = -(a+sqrt(a^2+b^4))/b;
dx(1) = x(2)
dx(2) = -(k/m)*(x(3)^2/x(1)^2)
dx(3) = -(R/L)* x(3)+(1/L)*u
...................
dx =
1
dx =
1 -Inf
dx =
1 -Inf NaN
??? Error using ==> funfun\private\odearguments at 113
CONTROLLER1 must return a column vector.
Error in ==> ode23 at 172
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ==> controller at 2
[t x] = ode23(@controller1,[0 5],[0 1 1])
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.121.136.17
※ 編輯: agersir 來自: 140.121.136.17 (02/08 20:01)
推
02/09 03:54, , 1F
02/09 03:54, 1F
→
02/09 03:55, , 2F
02/09 03:55, 2F
→
02/09 03:55, , 3F
02/09 03:55, 3F
喔~~注意到了!!謝謝
※ 編輯: agersir 來自: 140.121.136.17 (02/09 10:06)