How to make this integral
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!