Write a function to solve the following ordinary differential equation:
with
and either
or
. Along with y1, one of y0 and yp0 will be assigned numerical values, and the other will be NaN. The function should return the values of y at the specified values of x.
One of the applications for this equation is in groundwater. For
and
the equation arises in the flow of water to a well pumping in a leaky confined aquifer; the independent variable x is the normalized distance from the well, and y is related to the piezometric head, a combination of the elevation and pressure of the water. Specifying the derivative at a point amounts to specifying the flow to the well.
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers8
Suggested Problems
-
Find the sum of all the numbers of the input vector
54065 Solvers
-
17396 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
647 Solvers
-
Calculate the derivative of a polynomial
240 Solvers
-
Large Sum (inspired by Project Euler 13)
114 Solvers
More from this Author322
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Chris,
I solved the first test suite symbolically to make sure I was on the right path an got:
[1.0, 6.4839432567518947511762312927844, 9.0049224364695494006414430797622, 8.992494072596270056922480305016, 6.9752731606055591524878412503205, 3.6901871946858786387135688683041, 0].
I am not sure why it would be wrong.
syms y(x)
Dy = diff(y);
a=1;p=0;
X=linspace(1,4,7);
ode=diff(y,x,2)==-Dy/x+(p^2/x^2-a^2)*y;
conds=[y(1)==1, y(4)==0];
ySol(x)=simplify(dsolve(ode,conds));
Y=vpa(ySol(X));
Sorry David. I made a mistake with the signs in the last term of the equation. I "modified" the problem description (quotes intentional). This version should work, but please let me know if it doesn't.