Problem in solving highly complex second order ODE

1 visualizzazione (ultimi 30 giorni)
Peter
Peter il 14 Gen 2018
Commentato: Star Strider il 14 Gen 2018
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 Commento
Jan
Jan il 14 Gen 2018
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.

Accedi per commentare.

Risposte (1)

Star Strider
Star Strider il 14 Gen 2018
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 Commenti
Peter
Peter il 14 Gen 2018
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 il 14 Gen 2018
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.)

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by