Error in Bvp4c

3 views (last 30 days)
Priya M
Priya M on 23 Oct 2021
Commented: Priya M on 28 Oct 2021
I'm trying to run the following bvp4c MATLAB code, but keep running into an error:
please anyone find out my mistakes and correct me..
Thank you.

Accepted Answer

Jan
Jan on 23 Oct 2021
You define the variable beta on top of the code, but this does not mean, that it is known in all subfunctions. Pr, gamma and lam are not known inside also.
Either define the constants, where they are needed, or provide them using an anonymous function:
for gamma=0.0:0.25:1
sol = bvpinit(linspace(0,5,50),[0 0 0 0 0 0 0]);
fcn = @(t,y) bvpexam1(t, y, beta, gamma, lam, Pr);
sol1 = bvp4c(fcn, @bcexam1,sol);
...
end
function ysol = bvpexam1(t, y, beta, gamma, lam, Pr)
...
end
  5 Comments
Priya M
Priya M on 28 Oct 2021
Thanx a lot sir....

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!