Scaling variables for integration with ode15s

조회 수: 8 (최근 30일)
AM
AM 2022년 9월 15일
댓글: AM 2022년 9월 16일
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.

답변 (1개)

John D'Errico
John D'Errico 2022년 9월 15일
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
AM
AM 2022년 9월 16일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by