How can I solve the error "Unable to solve the collocation equation... (2024)

24 views (last 30 days)

Show older comments

J on 29 Jul 2024 at 8:56

  • Link

    Direct link to this question

    https://ms-www.mathworks.com/matlabcentral/answers/2141026-how-can-i-solve-the-error-unable-to-solve-the-collocation-equations-a-singular-jacobian-encounte

  • Link

    Direct link to this question

    https://ms-www.mathworks.com/matlabcentral/answers/2141026-how-can-i-solve-the-error-unable-to-solve-the-collocation-equations-a-singular-jacobian-encounte

Commented: Torsten on 29 Jul 2024 at 15:23

Accepted Answer: Torsten

  • W2.m

Open in MATLAB Online

I tried to solve the bvp using bvp4c procedure. But I have an error "Unable to solve the collocation equations -- a singular Jacobian encountered." How to resolve this issue?

proj()

Error using bvp4c (line 196)
Unable to solve the collocation equations -- a singular Jacobian encountered.

Error in solution>proj (line 31)
sol= bvp4c(@projfun,@projbc,solinit,options);

function sol= proj

A = 0.5;

Gr = 0.7;

Gc = 0.5;

Kp = 3.0;

beta = 0.5;

Pr = 0.3;

Df = 0.2;

Sc = 0.1;

L0 = 0.5;

Sr = 0.3;

M = 1;

Bi1 = 0.5;

Bi2 = 0.5;

K0 = 0.3;

myLegend1 = {};myLegend2 = {};

rr = [0.3 0.5 0.8];

for i =1:numel(rr)

Re = rr(i);

y0 = [1, 0, 1, 1, 0, 1, 0];

options =bvpset('stats','on','RelTol',1e-4);

x = linspace(0,10,500);

solinit = bvpinit(x,y0);

sol= bvp4c(@projfun,@projbc,solinit,options);

disp((sol.y(1,20)))

figure(1)

plot(sol.x,(sol.y(6,:)))

grid on,hold on

myLegend1{i}=['Pr = ',num2str(rr(i))];

xlabel('eta');

ylabel('(thetas-thetaf)/thetas');

i=i+1;

end

figure(1)

legend(myLegend1)

hold on

function dy= projfun(~,y)

dy= zeros(7,1);

dy(1) = y(2);

dy(2) = y(3);

dy(3) = (0.5*A*y(3) - Gr*y(4) - Gc*y(6) + (M + Kp + A)*y(2)) / (1 + (1/beta));

dy(4) = y(5);

dy(5) = (Pr*(0.5*A*y(5)) - Pr*Df*Sc*(0.5*A*y(7) + 2*A*y(6) - L0*y(6))) / (1 - (Pr*Df*Sc*Sr));

dy(6) = y(7);

dy(7) = (Sc*(0.5*A*y(7) + 2*A*dy(6)) - Sr*Pr*(0.5*A*y(5) + 2*A*y(4))) / (1 - (Sr*Df*Pr));

end

function res= projbc(ya,yb)

res= [

ya(2) - (1 + K0*ya(3));

ya(5) + Bi1*(1 - ya(4));

ya(7) + Bi2*(1 - ya(6));

yb(2);

yb(4);

yb(6);

yb(7)];

end

end

1 Comment

Show -1 older commentsHide -1 older comments

Torsten on 29 Jul 2024 at 9:11

Direct link to this comment

https://ms-www.mathworks.com/matlabcentral/answers/2141026-how-can-i-solve-the-error-unable-to-solve-the-collocation-equations-a-singular-jacobian-encounte#comment_3222876

  • Link

    Direct link to this comment

    https://ms-www.mathworks.com/matlabcentral/answers/2141026-how-can-i-solve-the-error-unable-to-solve-the-collocation-equations-a-singular-jacobian-encounte#comment_3222876

How to resolve this issue?

It's not a technical issue. Usually, there is something wrong with the equations or the boundary conditions. So you should compare both of them with the mathematical description of the problem.

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Torsten on 29 Jul 2024 at 13:53

  • Link

    Direct link to this answer

    https://ms-www.mathworks.com/matlabcentral/answers/2141026-how-can-i-solve-the-error-unable-to-solve-the-collocation-equations-a-singular-jacobian-encounte#answer_1491931

  • Link

    Direct link to this answer

    https://ms-www.mathworks.com/matlabcentral/answers/2141026-how-can-i-solve-the-error-unable-to-solve-the-collocation-equations-a-singular-jacobian-encounte#answer_1491931

Edited: Torsten on 29 Jul 2024 at 14:53

Open in MATLAB Online

Your ODE system is linear - thus you can determine its general solution having 7 free parameters. But incorporating of your boundary conditions leads to a linear system of equations where the coefficient matrix A is rank-deficient (rank 6 instead of rank 7). Consequently, your system is not solvable.

A = 0.5;

Gr = 0.7;

Gc = 0.5;

Kp = 3.0;

beta = 0.5;

Pr = 0.3;

Df = 0.2;

Sc = 0.1;

L0 = 0.5;

Sr = 0.3;

M = 1;

Bi1 = 0.5;

Bi2 = 0.5;

K0 = 0.3;

Mat = zeros(7);

Mat(1,2) = 1;

Mat(2,3) = 1;

Mat(3,2) = (M + Kp + A) / (1 + 1/beta);

Mat(3,3) = 0.5*A/(1 + 1/beta);

Mat(3,4) = -Gr/(1 + 1/beta);

Mat(3,6) = -Gc/(1 + 1/beta);

Mat(4,5) = 1;

Mat(5,5) = Pr*0.5*A/(1 - Pr*Df*Sc*Sr);

Mat(5,6) = - Pr*Df*Sc*(2*A - L0) / (1 - Pr*Df*Sc*Sr);

Mat(5,7) = - Pr*Df*Sc*0.5*A/ (1 - Pr*Df*Sc*Sr);

Mat(6,7) = 1;

Mat(7,4) = - Sr*Pr*2*A / (1 - Sr*Df*Pr);

Mat(7,5) = - Sr*Pr*0.5*A / (1 - Sr*Df*Pr);

Mat(7,7) = Sc*(0.5*A+2*A) / (1 - Sr*Df*Pr);

syms x1(t) x2(t) x3(t) x4(t) x5(t) x6(t) x7(t)

eqns = [diff(x1);diff(x2);diff(x3);diff(x4);diff(x5);diff(x6);diff(x7)]-Mat*[x1;x2;x3;x4;x5;x6;x7]==[0;0;0;0;0;0;0];

sol = dsolve(eqns,'MaxDegree',4)

sol = struct with fields:

x2: C3*(exp((t*(2976375*((13875*3^(1/2)*342589119285075140699353^(1/2))/1883723499362492536448 - 2321348855894375/1076413428207138592256)^(1/6) - 9802324*((3364850596725*((... x1: C1 + C2*(exp((t*(2976375*((13875*3^(1/2)*342589119285075140699353^(1/2))/1883723499362492536448 - 2321348855894375/1076413428207138592256)^(1/6) - 9802324*((33648505967... x3: C6*exp(-(t*(865^(1/2) - 1))/24) + C7*exp((t*(865^(1/2) + 1))/24) - C2*(exp((t*(2976375*((13875*3^(1/2)*342589119285075140699353^(1/2))/1883723499362492536448 - 23213488... x4: C2*(exp((t*(2976375*((13875*3^(1/2)*342589119285075140699353^(1/2))/1883723499362492536448 - 2321348855894375/1076413428207138592256)^(1/6) - 9802324*((3364850596725*((... x5: C4*exp((t*(9802324*((3364850596725*((13875*3^(1/2)*342589119285075140699353^(1/2))/1883723499362492536448 - 2321348855894375/1076413428207138592256)^(1/3))/960855558009... x6: C3*(exp((t*(2976375*((13875*3^(1/2)*342589119285075140699353^(1/2))/1883723499362492536448 - 2321348855894375/1076413428207138592256)^(1/6) - 9802324*((3364850596725*((... x7: C4*exp((t*(9802324*((3364850596725*((13875*3^(1/2)*342589119285075140699353^(1/2))/1883723499362492536448 - 2321348855894375/1076413428207138592256)^(1/3))/960855558009...

eqn1 = subs(sol.x2,t,0)-(1+K0*subs(sol.x3,t,0))==0;

eqn2 = subs(sol.x5,t,0)+Bi1*(1-subs(sol.x4,t,0))==0;

eqn3 = subs(sol.x7,t,0)+Bi2*(1-subs(sol.x6,t,0))==0;

eqn4 = subs(sol.x2,t,10)==0;

eqn5 = subs(sol.x4,t,10)==0;

eqn6 = subs(sol.x6,t,10)==0;

eqn7 = subs(sol.x7,t,10)==0;

[A,b] = equationsToMatrix([eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,eqn7])

A=

How can I solve the error "Unable to solve the collocation equation... (4)

b=

How can I solve the error "Unable to solve the collocation equation... (5)

rank(A)

ans = 6

rank([A,b])

ans = 7

1 Comment

Show -1 older commentsHide -1 older comments

Torsten on 29 Jul 2024 at 15:23

Direct link to this comment

https://ms-www.mathworks.com/matlabcentral/answers/2141026-how-can-i-solve-the-error-unable-to-solve-the-collocation-equations-a-singular-jacobian-encounte#comment_3223231

  • Link

    Direct link to this comment

    https://ms-www.mathworks.com/matlabcentral/answers/2141026-how-can-i-solve-the-error-unable-to-solve-the-collocation-equations-a-singular-jacobian-encounte#comment_3223231

I suspect the reason is that you don't have any boundary condition involving y(1).

Sign in to comment.

More Answers (0)

Sign in to answer this question.

See Also

Categories

MATLABProgramming

Find more on Programming in Help Center and File Exchange

Tags

  • bvp4c
  • jaccobian

Products

  • MATLAB

Release

R2015a

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


How can I solve the error "Unable to solve the collocation equation... (7)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

How can I solve the error "Unable to solve the collocation equation... (2024)

FAQs

What is a collocation error? ›

Collocation errors: A term used to refer or portray an occasion of inadequate atypical usage of misplaced word class, inappropriate preposition, and other errors involving clause and the verb (C. James 1998).

What is a singular Jacobian error in BVP4C? ›

Accepted Answer

A singular Jacobian indicates that the initial guess causes the solution to diverge. The BVP4C function finds the solution by solving a system of nonlinear algebraic equations. Nonlinear solvers are only as effective as the initial guess they start with, so changing your starting guess may help.

What are the common mistakes for collocations? ›

Here are some common lexical collocation errors: small fortune NOT little fortune, take a walk NOT make a walk, inflict pain NOT create pain, make an appointment NOT take an appointment, make a mistake NOT do a mistake.

What is collocation solution? ›

In mathematics, a collocation method is a method for the numerical solution of ordinary differential equations, partial differential equations and integral equations.

What is collocation method bvp4c? ›

bvp4c is a finite difference code that implements the three-stage Lobatto IIIa formula. This is a collocation formula and the collocation polynomial provides a C1-continuous solution that is fourth order accurate uniformly in [a,b]. Mesh selection and error control are based on the residual of the continuous solution.

How to choose initial guess for bvp4c? ›

Create an initial guess.

You must provide bvp4c with a guess structure that contains an initial mesh and a guess for values of the solution at the mesh points. A crude mesh of five points and a constant guess that satisfies the boundary conditions are good enough to get convergence when infinity = 3 .

What is the Jacobian condition? ›

In order to prove the Jacobi condition it will be assumed, as is customary, that the matrix fy'y' is of rank n — 1 at every point of the minimizing arc E ,* so that from Theorems 1 and 3 of § 1 the arc E must be a solution of Euler's equations of class C" at least.

What is an example of a collocation? ›

Adjective Collocations
  • Deep: Deep feeling, deep holes, deep trouble, deep sleep.
  • Heavy: Heavy rainfall, a heavy drinker, heavy snow, heavy traffic.
  • Strong: Strong smell, strong body, strong sense, strong denial.
  • Big: Big disappointment, big failure, big mistake, big surprise.

What is an example of a collocation analysis? ›

One of the first, and most cited examples of collocational analysis concerns the words strong and powerful . While both words mean arguably the same thing, it is statistically more common to see the word strong co-occur with the word tea .

What is the example of collocation method? ›

The most common example of collocation is interpolation, which comes in two versions: at a prescribed set of N points X(I), values Y(I) are given; construct a g(x) such that g(x(i))=y(i). The only choice the user has, then, is the method for transforming N pairs of data into a function defined for all X.

What is an example of a collocation set? ›

Collocations with 'set'
  • diverse set. You need a diverse set of industries for a healthy economy. ...
  • set a timetable. The commission did not set a timetable for work on the report. ...
  • set a trap. Then one day, hunters set a trap for the lion.
  • set of stairs. ...
  • set of tracks. ...
  • set the standard. ...
  • set the tone. ...
  • set your sights on.

Top Articles
Latest Posts
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 6109

Rating: 4.1 / 5 (42 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.