Setting an ODE function solution to a value. In order to find the range of a variable inside the function?

4 次查看(过去 30 天)
I am looking to plot a graph of say a velocity,v, against another range, say U.
This v is inside a function - the solution of this function I would like to fix at a value in order to get the v range.
I have used a my ode function in a loop in order to get a range of the function outcomes - this time I want to fix this, and get a range of another variable that is inside of it.
How would I do this? Is there an option/odeset way of doing this, or shall i define it when I use the function itself? I am using ode23 or similar.
Thanks in advance.

回答(1 个)

Eeshan Mitra
Eeshan Mitra 2017-3-30
If I understand your question, you wish to calculate input 'U' corresponding to a given 'v', which is the solution to ‘ode23’, instead of iterating through different values of input 'U'. You could either:
  1.     Use the option 'OutputFcn' to step within the iterations and look at the output of ‘ode23’. This still requires you to iterate through a range of inputs. Read more on 'OutputFcn' here:  https://www.mathworks.com/help/matlab/ref/odeset.html#input_argument_d0e708834 .
  2.    Use 'fsolve' along with ode23, or other ode solvers to solve for 'U' for a given 'v'. Note that this may require an initial guess that is relatively close to the expected solution. Read more on 'fsolve' here:  https://www.mathworks.com/help/optim/ug/fsolve.html .

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by