I cannot integrate my signal

Hello,
I have been trying to take non-symbolic and indefine integral of an envelope of a function by using trapz, cumtrapz. But I keep encountering with a straight line. How can I fix this?
Any help will be appriciated.

5 Comments

Please show us more details.
I am sorry for dublication. I am new in this web and matlab. My code is following.
x=10e5;
t=0:50
f=exp(t)
envelopeoff=envelope(f)
integral=cumsum(envelopeoff)
plot(integral)
format long g
x=10e5;
t=0:50
t = 1×51
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
f=exp(t)
f = 1×51
1 2.71828182845905 7.38905609893065 20.0855369231877 54.5981500331442 148.413159102577 403.428793492735 1096.63315842846 2980.95798704173 8103.08392757538 22026.4657948067 59874.1417151978 162754.791419004 442413.39200892 1202604.28416478 3269017.37247211 8886110.52050787 24154952.7535753 65659969.1373305 178482300.963187 485165195.40979 1318815734.48321 3584912846.13159 9744803446.2489 26489122129.8435 72004899337.3859 195729609428.839 532048240601.799 1446257064291.48 3931334297144.04
envelopeoff=envelope(f)
envelopeoff = 1×51
3.62287148472424e+21 6.21134623176489e+20 1.36108895110803e+21 4.58944496889762e+20 8.95209647892319e+20 3.93089308101083e+20 6.92890937308259e+20 3.59607290040845e+20 5.79989514500753e+20 3.40878030240296e+20 5.08267325541342e+20 3.30149131799469e+20 4.58966233096019e+20 3.24337816532068e+20 4.23267798996283e+20 3.21889716293583e+20 3.96486746802515e+20 3.21986468597084e+20 3.75914982393167e+20 3.24209662158308e+20 3.59893304954725e+20 3.28387234308425e+20 3.47368069608874e+20 3.3452394729068e+20 3.37664382547856e+20 3.42777583921185e+20 3.3036714503299e+20 3.53467044372536e+20 3.25263306945225e+20 3.6711178898035e+20
integral=cumsum(envelopeoff)
integral = 1×51
3.62287148472424e+21 4.24400610790073e+21 5.60509505900877e+21 6.06403955589853e+21 6.95924920379085e+21 7.35233851189193e+21 8.04522944920019e+21 8.40483673924103e+21 8.98482625374179e+21 9.32570428398208e+21 9.83397160952342e+21 1.01641207413229e+22 1.06230869744189e+22 1.0947424790951e+22 1.13706925899473e+22 1.16925823062408e+22 1.20890690530434e+22 1.24110555216404e+22 1.27869705040336e+22 1.31111801661919e+22 1.34710734711466e+22 1.37994607054551e+22 1.41468287750639e+22 1.44813527223546e+22 1.48190171049025e+22 1.51617946888237e+22 1.54921618338567e+22 1.58456288782292e+22 1.61708921851744e+22 1.65380039741548e+22
plot(integral)
That does not appear to be a straight lne.
Note that your values are quite large, above 1e21, because exp(50) is pretty large.
Arya Akhtar
Arya Akhtar on 24 May 2021
Edited: Arya Akhtar on 24 May 2021
Sir, I appriciated your effort and help. but my actual desire is to calculate area between upper envelope and lower envelope but I could not expressed this with my code above. If you could help me on this purpose I will be really happy.

Sign in to comment.

Answers (2)

x=10e5;
t=0:50;
f=exp(t);
i=cumtrapz(f);
plot(t,i);

2 Comments

Thank you for help sir!
But, I am trying to integrate upper envelope and lower envelope. How can I do that?
If exp(t) is the upper envelope, what is the lower envelope?

Sign in to comment.

format long g
t=0:50
t = 1×51
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
f=exp(t)
f = 1×51
1 2.71828182845905 7.38905609893065 20.0855369231877 54.5981500331442 148.413159102577 403.428793492735 1096.63315842846 2980.95798704173 8103.08392757538 22026.4657948067 59874.1417151978 162754.791419004 442413.39200892 1202604.28416478 3269017.37247211 8886110.52050787 24154952.7535753 65659969.1373305 178482300.963187 485165195.40979 1318815734.48321 3584912846.13159 9744803446.2489 26489122129.8435 72004899337.3859 195729609428.839 532048240601.799 1446257064291.48 3931334297144.04
[up_env, low_env] = envelope(f)
up_env = 1×51
3.62287148472424e+21 6.21134623176489e+20 1.36108895110803e+21 4.58944496889762e+20 8.95209647892319e+20 3.93089308101083e+20 6.92890937308259e+20 3.59607290040845e+20 5.79989514500753e+20 3.40878030240296e+20 5.08267325541342e+20 3.30149131799469e+20 4.58966233096019e+20 3.24337816532068e+20 4.23267798996283e+20 3.21889716293583e+20 3.96486746802515e+20 3.21986468597084e+20 3.75914982393167e+20 3.24209662158308e+20 3.59893304954725e+20 3.28387234308425e+20 3.47368069608874e+20 3.3452394729068e+20 3.37664382547856e+20 3.42777583921185e+20 3.3036714503299e+20 3.53467044372536e+20 3.25263306945225e+20 3.6711178898035e+20
low_env = 1×51
-3.30122115616733e+21 -2.99484294619573e+20 -1.03943862255112e+21 -1.37294168332846e+20 -5.73559319335403e+20 -7.14389795441662e+19 -3.71240608751343e+20 -3.7956961483929e+19 -2.58339185943837e+20 -1.92277016833793e+19 -1.86616996984425e+20 -8.49880324255236e+18 -1.37315904539103e+20 -2.68748797515212e+18 -1.01617470439367e+20 -2.39387736667062e+17 -7.48364182455991e+19 -3.36140040167784e+17 -5.42646538362503e+19 -2.55933360139187e+18 -3.82429763978084e+19 -6.73690575150832e+18 -2.57177410519579e+19 -1.28736187337636e+19 -1.60140539909397e+19 -2.11272553642682e+19 -8.71681647607408e+18 -3.181671581562e+19 -3.61297838830856e+18 -4.54614604234336e+19
integral = cumtrapz(up_env - low_env);
plot(t, integral)

Asked:

on 24 May 2021

Answered:

on 24 May 2021

Community Treasure Hunt

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

Start Hunting!