hi , I have system of coupled 1d differential equations , I write a code to solve them , the code run but it gives wrong results, can anyone told me what the problem in the code , this will help me a lot , thanks in advance
조회 수: 1 (최근 30일)
이전 댓글 표시
a system of N coupled differential equations dp/dt=-i*cos(c*t)*mat*p-i*p*w
p is vector p=[p1;p2;p3.....;pN];
mat is matrix (NXN) of constant numbers
w is vector of constant numbers w=[w1;w2;w3.....wN]
c is constant number
the code
function dp = myode1(t,p,mat,energy,c)
dp = (-i)*cos(c*t)*(mat*p)+(-i)*energy.*p;
end
[t,p] = ode45(@(t,p)myode1(t,p,mat,energy,c),[0 tf],initial_cond);
댓글 수: 2
답변 (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!