ODE-matlab

1 次查看(过去 30 天)
Cillian
Cillian 2012-6-11
Hello.
I want to solve this equation system:
x ̈ = q ( y ̇ B z − z ̇ B y ) m y ̈=−q (x ̇Bz−z ̇Bx) m z ̈= q (x ̇By −y ̇Bx) m x(0) = x0, y(0) = y0, z(0) = z0 x ̇(0) = v0,x, y ̇(0) = v0,y, z ̇(0) = v0,z.
and with B = [1 1 1]' and m=q=1.
When I look at the equation system it seems for me very complicated and I really don't have a clue how to solve this. But, here is my attempt so far:
function [dU]=ODE(t,U)
dU = zeros(size(U));
q=1;m=1;
x(0)=1; % Can I assume what x(0),y(0),z(0) , x1(0),y2(0) and z3(0) should be?
y(0)=1;
z(0)=1;
x1(0)=2;
y2(0)=2;
z3(0)=2;
v=[1;1;1];
x=[2;2;2];
B=[0;0;1];
Tt=100;
Tp=1;
B=Tt*file1(x)+Tp*file2(v);
x2=q./m*(diffy(y)*B(:,3)-diffy(z)*B(:,2))
y2=-q./m*(diffy(x)*B(:,3)-diffy(z)*B(:,1))
z2=q./m*(diffy(y)*B(:,3)-diffy(x)*B(:,1))
dy(1)= y(3)
dy(2)= y(4)
dy(3)= ?
dy(4)= ?
dy(5)= ?
dy(6)= ?
Can someone please, help me explain this?
Regards Cillian
  2 个评论
Cillian
Cillian 2012-6-11
For some reason, I get the warning:
"The selected cell cannot be evaluated because it contains an invalid statement."
Why is that?
Walter Roberson
Walter Roberson 2012-6-11
Are you attempting to execute code that has the question marks in it ??

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by