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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!