I need to solve two differential equations of the first order, with one unknown parameter in each equation (m_0 and m1 are unknown parameters), and I have four boundary conditions. My function for guessing solution is pinit
:
function pinit = mat4init(z)
pinit = [ 0.65.*cos(z)
0.65.*cos(z) ];
end
I also have function for boundary condtions mat4bc
, where I put boundary conditions for the first equation (with index 1) and after that for the second equation:
function res = mat4bc(pa, pb)
res = [ pa(1,:)-8
pb(1,:)-1
pa(2,:)
pb(2,:) ];
end
I am making assumption for unknown parameters m0, and m1 with values 2 and 1. Together with other values in matrix4ode
function are given differential equations :
function dpdz = matrix4ode(z, p)
m0 = 2;
m1 = 1;
z = linspace(0,pi,10);
ri = 0.7;
R = ri - z .* (ri - 1);
beta = 1;
dpdz = zeros(2, size(z,2));
dpdz(1,:) = - 32 .* beta .* m0 ./ (R .^ 4 .* p(1,:));
dpdz(2,:) = -( - 8 .* dpdz(1,:) ./ R - dpdz(1,:) .* p(2,:) - 32 .* beta .* m1 ./ R .^ 4 ) ./ p(1,:);
end
And I am using bvpinit
:
solinit = bvpinit(linspace(0,pi,10),@mat4init , [2 1]);
and after that calling bvp4c with code:
m0 = 2;
m1 = 1;
z = linspace(0,pi,10);
ri = 0.7;
R = ri - z .* (ri - 1);
beta = 1;
sol = bvp4c(@matrix4ode,@mat4bc,solinit);
and I got error:
Error using matrix4ode
Too many input arguments.
Error in bvparguments (line 105)
testODE = ode(x1,y1,odeExtras{:});
Error in bvp4c (line 130)
bvparguments(solver_name,ode,bc,solinit,options,varargin);
How when I have not additional input arguments in matrix4ode function? What should I do? Here is my code