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 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!