I am asking about the capabilities of the ode function. The situation in which I would be using it is irrelevant in this case.
Setting an ODE function solution to a value. In order to find the range of a variable inside the function?
조회 수: 5 (최근 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
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:
- 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 .
- 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 .
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!