MATLAB Answers

0

While solving boundary value problems (using bvp4c) the graph is plotted as the command ""plot (x,BS(1,:))"" but if I want the graph between x and y and not x and boundary solution (BS) what should I do ?

Asked by Aryaman Patel on 13 Jul 2019
Latest activity Answered by infinity
on 14 Jul 2019
This is the matlab script :
init = bvpinit(linspace(-1,1,20),[0 0]);
sol=bvp4c(@rhs_bvp,@bc_bvp,init);
x = linspace(-1,1,20);
BS=deval(sol,x);
plot(x,BS(1,:));
I do not understand the purpose of deval, also the graph i want to plot is between x and y not x and boundary solutions (bs).
How can i do that ?

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by infinity
on 14 Jul 2019
 Accepted Answer

Hello,
You might simply plot x and y like this
plot(sol.x, sol.y, '-o')
Several examples of how to use bvp4 and deval can be seen here

  0 Comments

Sign in to comment.