I am getting this error for the written code

function bvp4
tic
n=1.5;
s=[0,0,-0,0;0,0,0,-1;0,0,-1,0;0,0,0,-1/n];
options=bvpset('singularterm',s,'RelTol',0.01,'Nmax',50000);
guess=[1;0;0;0];
solinit=bvpinit(linspace(0,1,50),guess,options);
sol = bvp4c(@twoode,@twobc,solinit);
z=linspace(0,1,50);
solint=deval(sol,z);
toc
plot(z,solint(1,:))
function dydx=twoode(x,y)
K=10;
v=0.1;
n=1.5;
zeta=0.3;
dydx=[y(2);y(4);K^2*sinh(y(1))/(1+4*v*(sinh(y(1)/2))^2);-((K^(n+1))*(y(4)^(1-n))*sinh(y(1))/(1+4*v*(sinh(y(1)/2))^2))/(n^(n+1)*zeta)];
function res= twobc(ya,yb)
res=[ya(3);ya(4);yb(1)-0.3;yb(2)];
* _Cell contents reference from a non-cell array object.
Error in bvparguments (line 105)
testODE = ode(x1,y1,odeExtras{:});
Error in bvp4c (line 129)
[n,npar,nregions,atol,rtol,Nmax,xyVectorized,printstats] = ...
Error in new5vel (line 8)
sol = bvp4c(@twoode,@twobc,solinit);_
*

Antworten (1)

Jan
Jan am 4 Jun. 2018
Bearbeitet: Jan am 4 Jun. 2018

0 Stimmen

Why do you provide the options to bvpinit? If I change this to:
solinit=bvpinit(linspace(0,1,50),guess);
sol = bvp4c(@twoode,@twobc,solinit,options);
( options moved to bvp4c), I get the error:
Unable to solve collocation equations - a singular Jacobian encountered.

2 Kommentare

Anish  Pal
Anish Pal am 4 Jun. 2018
did not help
Jan
Jan am 4 Jun. 2018
Of course it does not help. As I wrote: the equation cannot be solved. But this implies that the readers of the forum cannot help you based on the currently provided information. I assume it is a programming error in the equation, but there is no chance to guess, what the problem is.

Melden Sie sich an, um zu kommentieren.

Produkte

Gefragt:

am 4 Jun. 2018

Kommentiert:

Jan
am 4 Jun. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by