Differential equation.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!