Scaling variables for integration with ode15s

5 visualizaciones (últimos 30 días)
AM
AM el 15 de Sept. de 2022
Comentada: AM el 16 de Sept. de 2022
Hello,
I am integrating a set of differential equations with ode15s and some of my variables have very different orders of magnitude; e.g some are within the [0,1] range and some can go as high as 1E30. I just wanted to know if this causes inaccuracies in the results and if I need to find a way to scale my variables or if there is an built-in option for that.
I am wondering because in the litterature I read detailing the equations I use for my model they recommend adding a scaling factor for integration but I do not know how to implement this yet and MATLAB does the integration anyways, I just don't know if the results are precise.

Respuestas (1)

John D'Errico
John D'Errico el 15 de Sept. de 2022
There is a reasonable chance your results may problematic, if you do not scale things. While you may get a result, you will have no idea if has has any usefulness. Possibly it will not, lacking that scaling.
Is there a built-in option for this? How could there be? MATLAB cannot read your mind. MATLAB does what you tell it to do. If it did not, instead modifying your problems as it thinks might be the case, this would itself be a serious problem.
How do you scale variables? Do you understand that, for example, in the metric system, you can work in meters, kilometers, nanometers, centimeters, etc. Another example, is to consider the distance to the nearest star is about 4 light years. A nice, easy number to work with. Would you rather record that distance in feet? Millimeters? Picometers?
Depending on the units chosen, your numbers will have MANY orders of magnitude difference. But YOU need to make that choice as is appropriate.
  1 comentario
AM
AM el 16 de Sept. de 2022
I see, thank you.
The reason I ask if there is a built in option for this is because solvers like fmincon have the FiniteDifferenceStepSize option that allows to account for different orders of magnitude for the calculation of the gradient of the objective function. I know an optimization solver is different from one that solves ODEs but I wondered if maybe there was a way one could tell matlab the order of magnitude expected.
I understand that units have to be adapted to the orders of magnitude of the variables being used, however I don't know how to implement this on my model yet.

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by