I could not integrate using MatLab, Can you please help me?

43 ビュー (過去 30 日間)
Tika Ram Pokhrel
Tika Ram Pokhrel 2021 年 5 月 2 日
コメント済み: Walter Roberson 2021 年 5 月 6 日
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
Walter Roberson 2021 年 5 月 5 日
Integration by parts, using a change of variables u=4*t

サインインしてコメントする。

採用された回答

Dyuman Joshi
Dyuman Joshi 2021 年 5 月 5 日
編集済み: Dyuman Joshi 2021 年 5 月 6 日
syms t a c
fun = 3*2^(1/2)*(1 - cos(4*t))^(1/2)*(a^2 + c^2)^(1/2);
z = int(fun,t); %gives indefinite integral
%result of integration, z = -(3*sin(4*t)*(a^2 + c^2)^(1/2))/(2*(sin(2*t)^2)^(1/2));
t=0;
res = z - subs(z);
%obtain final result by evaluating the integral, z(t)-z(0), by assigning t & using subs()
However, you will not get the result. See @Walter Roberson's comment below for more details.
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 5 月 5 日
編集済み: Walter Roberson 2021 年 5 月 5 日
Not quite.
syms t a c
fun = 3*2^(1/2)*(1 - cos(4*t))^(1/2)*(a^2 + c^2)^(1/2);
z = int(fun,t); %gives indefinite integral
char(z)
ans = '-(3*sin(4*t)*(a^2 + c^2)^(1/2))/(2*(sin(2*t)^2)^(1/2))'
z0 = limit(z, t, 0, 'right');
char(z0)
ans = '-3*(a^2 + c^2)^(1/2)'
res = simplify(z - z0);
char(res)
ans = '3*(a^2 + c^2)^(1/2) - (3*sin(4*t)*(a^2 + c^2)^(1/2))/(2*(sin(2*t)^2)^(1/2))'
fplot(subs(z, [a,c], [1 2]), [-5 5])
fplot((subs(fun,[a,c], [1 2])), [-5 5])
That is, the problem is that the integral is discontinuous at t = 0 and that is why int() cannot resolve it.

サインインしてコメントする。

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2021 年 5 月 5 日
syms a c t real
mag_dr = 3*2^(1/2)*(1 - cos(4*t))^(1/2)*(a^2 + c^2)^(1/2)
mag_dr = 
z = int(mag_dr, t)
z = 
z - limit(z, t, 0, 'right')
ans = 
The integral is discontinuous at 0, which is why it cannot be resolved by MATLAB.
  4 件のコメント
Dyuman Joshi
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
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
Sindhu Karri 2021 年 5 月 5 日
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.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by