Problem in solving highly complex second order ODE

1 次查看(过去 30 天)
Hi all,
I have formed a model for the removal of a small particle from a fluid interface, which has resulted in a rather complex second order ODE. I am trying to solve this by using "odeToVectorField" to break down the ODE into two first order equations. However, when I am running my script I am finding that it is taking a very long time to produce any result...or even error message. When it does, this is the error message I see:
Error using deval (line 132)
Attempting to evaluate the solution outside the interval [0.000000e+00, 8.145653e-08] where it is defined.
Error in @(x)deval(sol,x,1)
Error in fplot (line 104)
x = xmin+minstep; y(2,:) = feval(fun,x,args{4:end});
Error in SolutionAltered (line 36)
fplot(@(x)deval(sol,x,1), [0,100]).
For some reason I am having trouble typing my script into the text box, so a picture will have to suffice. (Sorry about how messy it is).
Now, having read around it seems as though this may be due to the fact that the equation is discontinuous in nature and so the solver cannot produce a solution. I have also attempted to use ODE23s as I suspect the problem is one in which is highly stiff, however this has not worked either. In all honesty my understanding of this is a bit clouded, so I was just looking for a second opinion as to what may be wrong, and how it is you recommend that I could get around this.
Any help would be great, Cheers!
  1 个评论
Jan
Jan 2018-1-14
Please post the code as text. It is easy, see http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099. Posting the code as screenshots on a different server is rather inconvenient for the readers. You can insert code in the question, attach it as file, and if you really need a screenshot images can be posted also.

请先登录,再进行评论。

回答(1 个)

Star Strider
Star Strider 2018-1-14
If you are integrating the same equation you posted earlier, deval and fplot will just complicate your code.
Do this instead:
sol = ode45(M,[0 100],[1 0]);
figure
plot(sol.x, sol.y(1,:))
Also, if you have a ‘stiff’ system, ode15s may be a better choice.
  13 个评论
Peter
Peter 2018-1-14
Thank you very much for dedicating so much time to helping me. I'll run this code you've provided me and will work towards understanding the issue with my equation.
I have a sneaking feeling it is to do with the inverse cosine, as this produces real solutions only within the interval of -1 to 1.
Star Strider
Star Strider 2018-1-14
My pleasure.
I certainly agree. The argument to acos is ((Y(1).*1.0e6-1.492928932188135e2), guaranteed to exceed ±1 for Y(1) >= 1.000149315184915e-06. I’m not certain how best to constrain ‘Y(1)’, although defining the acos argument to be tanh(Y(1))*1E-6 could work. That will bound it, and still be a differentiable function, so as opposed to being a ‘hard limit’, would not cause abrupt discontinuities of the sort that causes problems for the numeric ODE solvers. (I did not experiment with this. I leave that for you.)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by