I could not integrate using MatLab, Can you please help me?
古いコメントを表示
In solving a problem I need to integrate the following function with respect to 't' from the limit 0 to t.
3*2^(1/2)*(1 - cos(4*t))^(1/2)*(a^2 + c^2)^(1/2)
I used the following commands but got the same result as given herewith.
>> syms a c t real
mag_dr = 3*2^(1/2)*(1 - cos(4*t))^(1/2)*(a^2 + c^2)^(1/2)
>> int(mag_dr,t,0,t)
ans =
int(3*2^(1/2)*(1 - cos(4*t))^(1/2)*(a^2 + c^2)^(1/2), t, 0, t)
Let me know the best way(s) to tackle this type of problem.
1 件のコメント
Walter Roberson
2021 年 5 月 5 日
Integration by parts, using a change of variables u=4*t
採用された回答
その他の回答 (2 件)
syms a c t real
mag_dr = 3*2^(1/2)*(1 - cos(4*t))^(1/2)*(a^2 + c^2)^(1/2)
z = int(mag_dr, t)
z - limit(z, t, 0, 'right')
The integral is discontinuous at 0, which is why it cannot be resolved by MATLAB.
4 件のコメント
Dyuman Joshi
2021 年 5 月 6 日
編集済み: Dyuman Joshi
2021 年 5 月 6 日
@Walter Roberson, is it not a good idea to evaluate symbolic integration limit using subs() as I did as well as in general?
Walter Roberson
2021 年 5 月 6 日
Look more carefully at what you did. You coded
t=0;
res = z - subs(fun);
You are substituting t = 0 into fun not into z .
If you substitute t = 0 into z then you will get an error about division by 0.
You are doing the equivalent of trying to evaluate int(f, x, a, b) as F(b) - f(a) instead of F(b) - F(a)
Example:
Integral of sin(x) for a full rotation, 2*pi, is 0 because the area above the axes is exactly balanced by the area below the axes. So int(sin(x), x, 0, 2*pi) should be 0. But your method would use subs(int(sin(x),x), x, 2*pi) - subs(sin(x),x,0) which would be subs(cos(x), x, 2*pi) - sin(0) which would be cos(2*pi) - 0 which would be 1 - 0 which is 1 which is incorrect. What is needed instead is subs(int(sin(x),x),x,2*pi) - subs(int(sin(x),x),x,0) which would be cos(2*pi) - cos(0) which would be 1 - 1 which would be 0 which is the correct solution.
Dyuman Joshi
2021 年 5 月 6 日
The wrong substitution was a mistake on my part, mostly cause I did it in a hurry. I have edited my nswer accordingly as well. Other than that, is subs() a good approach or would you recommend otherwise?
Walter Roberson
2021 年 5 月 6 日
limit() is more robust than subs() for cases like this. But limit() is sometimes quite expensive to calculate, or is beyond MATLAB's ability to calculate, even in some finite cases.
Sindhu Karri
2021 年 5 月 5 日
0 投票
Hii
The "int" function cannot solve all integrals since symbolic integration is such a complicated task. It is also possible that no analytic or elementary closed-form solution exists.
For definite integrals, a numeric approximation can be performed by using the "integral" function.
1 件のコメント
Walter Roberson
2021 年 5 月 5 日
It does exist.
カテゴリ
ヘルプ センター および File Exchange で Mathematics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


