Scaling variables for integration with ode15s
2 ビュー (過去 30 日間)
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 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.