How to make this integral

1 view (last 30 days)
Peppe
Peppe on 21 Sep 2017
Commented: Walter Roberson on 22 Sep 2017
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

Answers (1)

Walter Roberson
Walter Roberson on 21 Sep 2017
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 Comments
Peppe
Peppe on 22 Sep 2017
Edited: Peppe on 22 Sep 2017
Thankbyou for your respond How would the simulink block look like? Is same integrator used for both and same iniial condition?
Walter Roberson
Walter Roberson on 22 Sep 2017
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!