MATLAB Answers

ode 45 third order and boundary conditions

1 ビュー (過去 30 日間)
Daniel Kubiat
Daniel Kubiat 2019 年 3 月 28 日
Commented: Daniel Kubiat 2019 年 3 月 28 日
%this is my main file and im sure of it
function ydot = kubieodeee(t, y )
M = 0.5;
Nt = 0.3;
Nb = 0.1;
Pr = 0.2;
Le = 1.0;
ydot = zeros(7, 1); % Pre-allocate
ydot(1) = y(2); % f '
ydot(2) = y(3); % f ''
ydot(3) = -y(1) * y(3) + M * y(2); % f''' = -y(1)*y(3) + 0.5*y(2 )
ydot(4) = y(5); % theta '
ydot(5) = -Pr * (Nb * y(7) * y(5) + Nt * y(5) * y(5)); % theta ''
ydot(6) = y(7); % psi '
ydot(7) = - (Nt/Nb) * ydot(5) - (Le/Nb) * y(1); % psi ''
%BUT I HAVE ISSUES WITH THIS PART WHICH MAKES MY CODE RUN AND PLOT MY GRAPH PLEASE I NEED HELP FILLING THE BLANK SPACE IM VERY CLOSE TO MAKING THIS A SUCCESS AND THIS PALTFORM HAS BEEN REALLY HELPFUL.HELP ME OUT PLEASE
clc
clear all
y0=zeros(7,1);
y0(1) = 0; % f
y0(2) = 1 + 0.3; % f'
y0(3) = 0; % f''
y0(4) = 1; % theta
y0(5) = 0; % theta'
y0(6) = 0; % psi
y0(7) = 0; % psi'
init = [0 0 x];
eta = [0,20];
[t y] = ode45('kubieodeee',eta,init);
end
plot(t,y(:,1));
axis equal
axis([0 3 0 2])
legend()
grid on

  0 件のコメント

サインイン to comment.

件の回答 (1)

Daniel Kubiat
Daniel Kubiat 2019 年 3 月 28 日
I COPIED THIS FORMAT OF CODE THAT I SAW ON HERE AND RAN IT BUT I NEED HELP TO MAKE MINE WORK
clc
clear all
xmin=0;
xmax=2;
while((xmax-xmin)>10e-6)
x=(xmin+xmax)/2;
init = [0 0 x];
eta = [0 5];
[t,y] = ode45('eqn',eta,init)
%max(y(:,2))
if max(y(:,2))>1
xmax=x;
else
xmin=x;
end
end
plot(t,y(:,3),'r+-',t,y(:,2),'b*-',t,y(:,1),'g+-')
axis equal
axis([0 3 0 2])
legend('d2F','dF','F')
grid on
%MAINFILE
function f = eqn(t,y)
f = zeros(size(y));
f(1) = y(2);
f(2) = y(3);
f(3) = -1 -2*y(1)*y(3) + y(2)*y(2);V

  4 件のコメント

表示 1 件の古いコメント
Daniel Kubiat
Daniel Kubiat 2019 年 3 月 28 日
Please can I do this sticking with ode 45. I know it’s possible I just need guidance
Torsten
Torsten 2019 年 3 月 28 日
ODE45 is an ODE integrator suited for initial value problems.
Since your problem is a boundary value problem, ODE45 is not the suitable tool.
Use BVP4C instead.
Daniel Kubiat
Daniel Kubiat 2019 年 3 月 28 日
I have no idea on how to do that can you help out please

サインイン to comment.

サインイン してこの質問に回答します。


Translated by