2017-05-10 3 views
0

Ich möchte nur ODE45 behalten die letzte Lösung. Liefert vielmehr alle Lösungen aus dem tspan = [t0 tf]; Ich möchte nur, dass der zurückgegebene Vektor die Lösung bei tf ist.MATLAB ODE45: nur letzte Lösung speichern

Der Grund, warum Ich mag würde, dies zu tun ist, um die folgenden Fehler zu vermeiden:

Error using horzcat Requested 442368x1828 (6.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.

Error in ode45 (line 428) yout = [yout, zeros(neq,chunk,dataType)];

Antwort

2

Aus der Dokumentation:

tspan — Interval of integration vector Interval of integration, specified as a vector. At minimum, tspan must be a two element vector [t0 tf] specifying the initial and final times. To obtain solutions at specific times between t0 and tf, use a longer vector of the form [t0,t1,t2,...,tf]. The elements in tspan must be all increasing or all decreasing.

The solver imposes the initial conditions, y0, at tspan(1), then integrates from tspan(1) to tspan(end):

If tspan has two elements, [t0 tf], then the solver returns the solution evaluated at each internal integration step within the interval. If tspan contains more than two elements [t0,t1,t2,...,tf], then the solver returns the solution evaluated at the given points. This does not affect the internal steps that the solver uses to traverse from tspan(1) to tspan(end). Thus, the solver does not necessarily step precisely to each point specified in tspan. However, the solutions produced at the specified points are of the same order of accuracy as the solutions computed at each internal step. Specifying several intermediate points has little effect on the efficiency of computation, but for large systems it can affect memory management. The solution obtained by the solver might be different depending on whether you specify tspan as a two-element vector or as a vector with intermediate points. If tspan contains several intermediate points, then they give an indication of the scale for the problem, which can affect the size of the initial step taken by the solver.

So nur drei Punkte angeben. [t0 (t0+tf)/2 tf]

Verwandte Themen