# bvp4c's guess for boundary conditions

2 visualizaciones (últimos 30 días)
Bobby Fischer el 18 de Jun. de 2021
Comentada: Bobby Fischer el 22 de Jun. de 2021
Hi. I'd like to know why the initial guess for the solution shouldn't always be the boundary conditions themselves. That is, why not have yinit = [1 ; 2] ; instead of yinit = [1.5 ; 0] ; as is the case in the image below.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Divija Aleti el 22 de Jun. de 2021
Hi Bobby,
In the case mentioned above, the first element of yinit corresponds to z1 (which is the entire solution y) and not y(0), and its second element corresponds to z2 (which is its derivative y') and not y(1). I hope this clarifies the confusion.
Now, the initial guess for the solution can either be a function of x, or a constant for all values of x. It must be noted that the guess should be made keeping in mind how the solution of a problem might look like for all the given values of x.
Here, the initial guess for the solution y (which is z1) is chosen as the average of the values of y at the boundary conditions ((1+2)/2 = 1.5), which is a reasonable guess. The initial guess for its derivative y' (which is z2) is chosen as 0 (as y is chosen as a constant, its derivative will be 0). Hence,
yinit = [1.5; 0];
Generally, while choosing initial guesses, it is always good to use intuition and figure out how the solution might look like. Random initial guesses will also work sometimes, but will take a longer time to converge and arrive at the solution.
For a detailed example on the usage of the function bvp4c, have a look at the following link: bvp4c
Hope this helps!
Regards,
Divija
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Bobby Fischer el 22 de Jun. de 2021
Thank you, now I understand bvp4c a little more.

Iniciar sesión para comentar.

### Categorías

Más información sobre Boundary Value Problems en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by