Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Help understanding the syntax of an ODE
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm trying to understand how the following syntax is interpreted in trying to solve an ODE:
I have
[T,ZZ] = ode113(@(t,Z) dZdt(Z,s,zeta), [0 time_end], Z)
where Z is a vector representing points on a curve. The function dZdt.m takes Z as an input and computes dZdt, and requires s and zeta as constants.
My question is, what purpose does @(t,Z) serve? I cannot find a suitable answer in the documentation. To make me even more confused, I see many examples like
[T,Z] = ode113('function_name',...,...)
which makes me wonder why I can't just enter the string of my function name.
댓글 수: 0
답변 (1개)
Star Strider
2017년 5월 15일
‘My question is, what purpose does @(t,Z) serve?’
It creates a function handle that specifies that ‘t’ and ‘Z’ are arguments to your function. This is what the MATLAB ODE solvers require as their function call syntax.
Note that your function doesn’t have to use ‘t’ in its code or its argument list, but ‘t’ must be in the argument list presented to the ODE solvers, or your ODE solver call will throw a ‘Too many input arguments.’ error when the ODE solver attempts to pass ‘t’ to it as an argument.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!