Need help while defining ode function for bvp4c/bvp5c/ode45 solve

4 次查看(过去 30 天)
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 个评论
Md Sojib
Md Sojib 2024-6-6
编辑:Md Sojib 2024-6-6
I don't have any separate equation for p or p'. But after derivation, differential equations contains these two terms.
Torsten
Torsten 2024-6-6
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 ?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by