How can i include within ode45 solver a BVP solution derived by a different function-file?
1 view (last 30 days)
Show older comments
Dear Sir,
I am trying to apply a RK time-marching scheme on a system of DEs. I am not including the whole scripts because i don't like to mess you up (there a several functions and subfunctions). In brief the RK function file is
function dz=tdomain(t,z)
global yf dt Nf Fifx Fify g
for i=1:Nf
% initial conditions are vectors of size Nf
% dx/dt
dz(i)=dt*Fix(i);
% dy/dt
dz(i+Nf)=dt*Fiy(i);
% dφ/dt
dz(i+2*Nf)=0.5*(Fix(i)+Fiy(i)).^2-g*yf;
end
which is called within another script file:
.... ntime=10; time=linspace(0,0.01,ntime); [t,z]=ode45(@tdomain,[0 0.01],[xf yf Fifi]);
These initial values xf, yf are coordinates, and Fifi is a zero velocity potential of a free surface. The values "Fix, Fiy" within the solver function are velocity potential gradients solved by another, Boundary element collocation method function (Laplae 2D solver). My question is how could i call this collocation function to be solved at each substep of the RK4 method or how could i call it within the DE system vector?
If helpful, the syntax of the collocation function's head is:
function [Fi,Fix,Fiy,Nw,Nf,x,y]=bemsol(xb,yb,xf,yf,xsym,ysym,xw,yw,... Vw,beta,Fifi)
0 Comments
Answers (1)
Star Strider
on 20 May 2014
I don’t fully understand what you want to do, but core MATLAB has Boundary Value Problems solvers. You don’t mention that you’ve explored them, so perhaps they will do what you want.
4 Comments
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!