How to make this integral
이전 댓글 표시
Hi Suppose we have following equation:
S(x,t) = p(x,t) + k * int_0^t h(\tau) d\tau.
What is the difference between this and S(x,t) = p(x,t) + k * int_0^t h(t) dt ?
How ould the simulink block differs? I appritiate any help. Thank you
답변 (1개)
Walter Roberson
2017년 9월 21일
The
S(x,t) = p(x,t) + k * int_0^t h(t) dt
version is at least confusing, as it is using t both as a parameter to S and as the name of the variable to integrate over in the int() part.
S(x,t) = p(x,t) + k * int_0^t h(\tau) d\tau
can be written as
S = @(x, t) p(x,t) + k * integral(@(tau) h(tau), 0, t)
and
S(x,t) = p(x,t) + k * int_0^t h(t) dt
can potentially be written as
S = @(x, t) p(x,t) + k * integral(@(t) h(t), 0, t)
which would evaluate to the same. However, consider that if someone wrote
int_0^x sin(x)
they would normally mean the indefinite integral int( sin(x) ) -- integration of sin(x) with upperbound x. That is not the same thing that is happening with
S = @(x, t) p(x,t) + k * integral(@(t) h(t), 0, t)
which is first substituting the current specific value of t into the upper bound and then happening to use a lexically-different t as the name of the anonymous variable.
댓글 수: 2
Walter Roberson
2017년 9월 22일
As outlined above, there are two potential interpretations of int_0^t h(t) dt .
In one of them, the t that is the upper bound is to be interpreted as the t that is the parameter to the function, with the t of h(t) dt being interpreted as a different t. That interpretation has exactly the same implementation as the version using tau, because the careful programmer would choose a different variable of integration to eliminate confusion... oh, say, tau perhaps.
In the other interpretation, the t that is the upper bound is to be interpreted as the t of h(t) dt. In that situation, this is an indefinite integration that would result in a symbolic formula. Simulink cannot really calculate symbolic formulae through its blocks, and you would need a quite different implementation to work around the limitation that Simulink does not like to carry around anything other than numeric and logical values.
카테고리
도움말 센터 및 File Exchange에서 Signal Import and Export에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!