Integral in odefun bvp4c
Show older comments
I am working on the solution of the following 4th order ode:
y'''' + y'' * integral( y' ^ 2 ) = 10
b.c.: y(0) =0; y'(1)=0; y''(1)=0; y'''(1)=0;
How can I write my last equation in @myode?
Thanks in advance for your help.
% ---------------------------------------------------------------------
function fun
clc;
clear;
close all;
%y(4)+y(2)*integral(y(1)^2,0,L)=10
solinit = bvpinit(linspace(0,1,10),[0;0;0;0]);
sol=bvp4c(@myode,@mybc,solinit);
figure;
plot(sol.x,sol.y);
% ---------------------------------------------------------------------
function dydx = myode(x,y)
dydx = [y(2)
y(3)
y(4)
% 10-y(3)*integral(y(2)^2,0,1)
];
% ------------------------------------------------------------
function bc = mybc(ya,yb)
bc = [ya(1)
ya(2)
yb(2)
yb(3)];
Answers (1)
Michael Gareis
on 9 Nov 2020
0 votes
I would try preparing your equation first by dividing by y'':
y''''/y'' + integral( y' ^ 2 ) = 10/y''
then derive it (consider quotient rule!), to eliminate the integral:
(y'''''*y'''-y'''*y'''')/y''^2+y'^2 = -10y'''/y''^2
and multiplying by y''^2:
y'''''*y'''-y'''*y'''' + y'^2 = -10y'''
Which is a 5th order equation. Reduced to a 1st order equation you should get this set of 5 equations:
dydx = [y(2);
y(3);
y(4);
y(5),
(-10y(4)-y(2)^2-y(4)*y(5))/y(4)];
You now need to set a 5th BC and extend your initial guess by one column to solve your problem.
2 Comments
Pierluigi Auriti
on 9 Nov 2020
Edited: Pierluigi Auriti
on 10 Nov 2020
Michael Gareis
on 11 Nov 2020
Yes sorry, should be y'''''*y''-y'''*y'''' + y'^2*y''^2 = -10y'''
Since y itself doesn' show up in your equation, you can further simplify it by defining for example g=y'. And work with derivatives of g instead, eventually reducing the order by 1.
Categories
Find more on Boundary Value Problems 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!