Need help while defining ode function for bvp4c/bvp5c/ode45 solve
4 views (last 30 days)
Show older comments
I wanted to define system of ode functions for my higher order problems. I have differential equations are :
x=cosy
z=siny
y'=sqrt((lambda*f*p*siny/x)+(siny^2/x^2)-(2/lambda^2)+(2*cosy/lambda)-(3*a*p^2*lambda^2/2))
y"=(-y'*x'/lambda*x)-(cosy/x)-(f*p'/4)-(f*x'*p/4*x)+(y'*cosy/x)+(siny/lambda)+(lambda*f*p*cosy/4*x)+(siny*cosy/x^2)+(mu_1*(sin(y) - mu_2*cos(y)) / (2 * x^2)
where, y,x,p are functions of s. and f,lambda and a are constants.
while defining ode function for my bvp solve, I write the code as
function dydx = odefun2(t, y, params)
lambda = params.lambda;
a = params.a;
f = params.f;
mu_1=params.mu_1;
mu_2=params.mu_2;
y1 = y(1); % y
y2 = y(2); % x
y3 = y(3); % z
y4 = y(4); % p
y5 = y(5); % p_dot
y6 = cos(y1); %x_dot
y7 = sin(y1); %z_dot
ydot = sqrt((lambda * f * y4 * sin(y1) / y2) + (sin(y1)^2 / y2^2) - (2 / lambda^2) + (2 * cos(y1) / lambda) - (3 * a * (y4^2) * lambda^2)/2);
yddot = -((ydot * cos(y1) / (lambda * y2))) - (cos(y1) / y2) - (0.5 * y5 / 4) - (0.5 *cos(y1) * y4 / (4 * y2)) + (ydot * cos(y1) / y2) + (sin(y1) / lambda) + (0.5 * lambda * y4 * cos(y1) / (4 * y2)) + (sin(y1) * cos(y1) / y2^2) + (mu_1*(sin(y1) - mu_2*cos(y1)) / (2 * y2));
dydx = [y5; y6; y7; ydot; yddot];
end
But I have no equation for p'. And I am not sure that how can I relate x and z with x' and z' respectively. Also I don't have any differential equation for p'. how I should relate p and p'?
need some suggestions.
11 Comments
Torsten
on 6 Jun 2024
Then you will have to dive into the derivation of the equations again. If you don't know the equation for a function within your problem formulation, how do you want to solve it ?
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!