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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by