Shooting method for boundary value problems
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I use ODE45 and the shooting method to solve boundary value problems. There was a specific case in second order differential equations, where an unknown initial condition (which is to be found using shooting method) is a part of the expression of the second derivative, something like the following code. I want to know how to include it in the function and do I need to use any looping statements for it.
funtion dy = diffe(x,y)
l = 2;
p = 3;
dy = [y(2); p*x^2+2*y(1)+y0];
end
So in this code, value of dy/dx at x=0 is known but the value of y at x=0 is not known, but the value of y at x=1 (second boundary is known). This function is to be called like this:
funtion odesolver
dy0 = 0;
[x,y] = ode45(@diffe, [0 1], [y0, dy0]);
end
If someone can recommend a solution to this, that'll be very helpful.
1 Kommentar
Antworten (1)
Basavaraj
am 29 Okt. 2024
funtion dy = diffe(x,y)
l = 2;
p = 3;
dy = [y(2); p*x^2+2*y(1)+y0];
end
funtion odesolver
dy0 = 0;
[x,y] = ode45(@diffe, [0 1], [y0, dy0]);
end
0 Kommentare
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!