Differential equation.

1 次查看(过去 30 天)
Francesco
Francesco 2012-1-31
I have to solve two differential equation and I have used the following code:
inits='y(0)=0, Dy(0)=0, x(0)=0, Dx(0)=0';
[y,x]=dsolve('D2y=(q*B)/(m_H*v_H)', 'D2x=(q*E)/(m_H*v_H^2)', inits,'z');
The problem I have is that B and E, magnetic and electric field, are defined in a certain region, let' say:
B=1 if 0<=z=<15 cm
E=1 if 8<=z<=16 cm
E=B=0 outside these regions.
Basically E and B have hard-edge shape and are parallel and both othogonal to z direction.
Moverover I want to solve the equations for a longer path, let's say z=40cm where I have an imaging device.
How can I deal with those field?
It would be better to use an ode solver and rewrite the code as:
[z,x] = ode23(odefun1,[z0,zf],x0,options)
and another one for the other equation, giving the field shape in the option?

回答(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