Hey guys, I am new to PF. I need to be able to model a stiff differential equation in MatLab. I haven't used MatLab before so I am not really sure how to set the function and boundary conditions for the equation:(adsbygoogle = window.adsbygoogle || []).push({});

y'' + (2/x)*Y' = (.7/x^2)*( (y^(-1/2)) - (.067)((1-y)^(-1/2) )

y(0)=0

y'(1)=1

The zero boundary is undefined and there is a lot of singularities in the solution itself.

So far I have:

function dy = f(x,y)

y = [1 1];

k = .7;

lambda = .67;

xspan = [0 10];

ic = [0 1];

dy=[y(2); (-2/x) * y(2) + (k/(x)^2)*( (y(1)^(-1/2)) - lambda*((1-y(1)))^(-1/2) )];

[x,y] = ode15s(@f,xspan,ic);

plot(x,y(:,1),'-o')

And I am getting a an error in the command console:

??? Input argument "x" is undefined.

Error in ==> f at 7

dy=[y(2); (-2/x) * y(2) + (k/(x)^2)*( (y(1)^(-1/2)) -

lambda*((1-y(1)))^(-1/2) )];

I do not know where to go from here.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Second Order Differential Equations in MatLab

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - Second Order Differential | Date |
---|---|

I Question about second order linear differential equations | Aug 21, 2017 |

I Second order DE with Sine function | Apr 7, 2017 |

I Second order differential equation | Oct 27, 2016 |

A Second Order Differential equation Bessel-type | Sep 14, 2016 |

A Nonhomogeneous second order nonlinear differential equations | Apr 11, 2016 |

**Physics Forums - The Fusion of Science and Community**