Matlab does not integral the long function

4 ビュー (過去 30 日間)
Xinyu Liu
Xinyu Liu 2020 年 11 月 12 日
コメント済み: Ameer Hamza 2020 年 11 月 12 日
I'm running a project and got this function in matlab :
It1= (176567213623879289833666003849645*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/316912650057057350374175801344 + (3969*exp(-207/(1000*((391473114645473*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/562949953421312 + 4675603322059651/18014398509481984))))/4 + (1552493519019511649*(1 - ((391473114645473*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/562949953421312 + 4675603322059651/18014398509481984)^2)^(1/2))/2251799813685248 + (6035185237487246127*exp(-207/(1000*((391473114645473*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/562949953421312 + 4675603322059651/18014398509481984)))*((391473114645473*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/562949953421312 + 890695189918650103/2251799813685248000))/45035996273704960 + 2835156233222016111370674437094247/10141204801825835211973625643008
It looks long but only has one variable t, now I want to integral it from 5 to 19, I typed code like this but matlab dose not evaluate it. How do I get a value for this integration?
It2= int(It1,t,5,19)
Thanks!

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 11 月 12 日
編集済み: Ameer Hamza 2020 年 11 月 12 日
int() is used for symbolic integration. If MATLAB cannot find a closed-form expression for output, then it will just return the integral expression again. You can find a numerical solution using vpa()
It2 = int(It1,t,5,19);
It2 = vpa(It2);
Another solution is to convert the expression to floating-point format and then use integral() will be faster
It1 = (176567213623879289833666003849645*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/316912650057057350374175801344 + (3969*exp(-207/(1000*((391473114645473*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/562949953421312 + 4675603322059651/18014398509481984))))/4 + (1552493519019511649*(1 - ((391473114645473*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/562949953421312 + 4675603322059651/18014398509481984)^2)^(1/2))/2251799813685248 + (6035185237487246127*exp(-207/(1000*((391473114645473*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/562949953421312 + 4675603322059651/18014398509481984)))*((391473114645473*cos((pi*(15*t - 6392242573992627495/36028797018963968))/180))/562949953421312 + 890695189918650103/2251799813685248000))/45035996273704960 + 2835156233222016111370674437094247/10141204801825835211973625643008;
It1 = matlabFunction(It1)
It1 = integral(It1, 5, 19)
  2 件のコメント
Xinyu Liu
Xinyu Liu 2020 年 11 月 12 日
Thank you!
Ameer Hamza
Ameer Hamza 2020 年 11 月 12 日
I am glad to be of help!!!

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

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by