Clear Filters
Clear Filters

How to integrate the function in Matlab?

1 view (last 30 days)
given y(t) = a*x+b*(((t^2/2)+t))+c*(((t^3/3)+t^2+t))+d*(((t^4/4)+t^3+((3*t^2)/2)+t))+e*(((t^5/5)+t^4+2*t^3+2*t^2+t))+f*(((t^6/6)+t^5+((5*t^4)/2)+((10*t^3)/3)+((5*t^2)/2)+t))
int((exp(x-t)*(y(t)^3)),t,0,1)

Answers (1)

Ameer Hamza
Ameer Hamza on 1 May 2020
Edited: Ameer Hamza on 1 May 2020
Try this
syms t
s = 0.3;
a = 0.2;
b = 0.5;
c = 0.3;
d = 0.8;
e = 0.1;
f = 0.8;
x = 0.3;
y = a*x+b*(((t^2/2)+t))+c*(((t^3/3)+t^2+t))+d*(((t^4/4)+t^3+((3*t^2)/2)+t))+e*(((t^5/5)+t^4+2*t^3+2*t^2+t))+f*(((t^6/6)+t^5+((5*t^4)/2)+((10*t^3)/3)+((5*t^2)/2)+t));
y_int = int((exp(x-t)*(y^3)),t,0,1);
y_int2 = vpa(y_int);
disp(y_int) % symbolic output
disp(y_int2) % output in decimal format
Result
(3*exp(-7/10)*(14312622602045415832*exp(1) - 38905741936622033629))/1000000
164.22632490929883023849072628867
  2 Comments
Ravikiran Mundewadi
Ravikiran Mundewadi on 1 May 2020
a,b,c,d,e,f are constants without values how to calculate?
Ameer Hamza
Ameer Hamza on 1 May 2020
If they are unknown constants, then you can also define them as symbolic variables
syms t s a b c d e f x
y = a*x+b*(((t^2/2)+t))+c*(((t^3/3)+t^2+t))+d*(((t^4/4)+t^3+((3*t^2)/2)+t))+e*(((t^5/5)+t^4+2*t^3+2*t^2+t))+f*(((t^6/6)+t^5+((5*t^4)/2)+((10*t^3)/3)+((5*t^2)/2)+t));
y_int = int((exp(x-t)*(y^3)),t,0,1);
The output will be a symbolic expression in term of (s a b c d e f x).
y_int = 20339574*d^3*exp(x) + 28436783046*e^3*exp(x) + 80571537949566*f^3*exp(x) - (4821*b^3*exp(x - 1))/8 - (2665441*c^3*exp(x - 1))/27 - (3538475895*d^3*exp(x - 1))/64 - (9662398822711*e^3*exp(x - 1))/125 - (1752129179993373*f^3*exp(x - 1))/8 + 222*b^3*exp(x) + 36318*c^3*exp(x) - a^3*x^3*exp(x - 1) + 17838*b*c^2*exp(x) + 3252*b^2*c*exp(x) + 914130*b*d^2*exp(x) + 19818*b^2*d*exp(x) + 77530230*b*e^2*exp(x) + 6773016*c*d^2*exp(x) + 143892*b^2*e*exp(x) + 819570*c^2*d*exp(x) + 9819703674*b*f^2*exp(x) + 676668594*c*e^2*exp(x) + 1205850*b^2*f*exp(x) + 7218954*c^2*e*exp(x) + 98703428940*c*f^2*exp(x) + 7108899858*d*e^2*exp(x) + 72227142*c^2*f*exp(x) + 634676832*d^2*e*exp(x) + 1184848286826*d*f^2*exp(x) + 7404854034*d^2*f*exp(x) + 16114285888956*e*f^2*exp(x) + 1137476253630*e^2*f*exp(x) - (96967*b*c^2*exp(x - 1))/2 - (35345*b^2*c*exp(x - 1))/4 - (79515243*b*d^2*exp(x - 1))/32 - (861849*b^2*d*exp(x - 1))/16 - (10537449387*b*e^2*exp(x - 1))/50 - (294575189*c*d^2*exp(x - 1))/16 - (7822617*b^2*e*exp(x - 1))/20 - (26733731*c^2*d*exp(x - 1))/12 - (213541775907*b*f^2*exp(x - 1))/8 - (45984397557*c*e^2*exp(x - 1))/25 - (26222619*b^2*f*exp(x - 1))/8 - (294347011*c^2*e*exp(x - 1))/15 - (1073214948765*c*f^2*exp(x - 1))/4 - (1932399324261*d*e^2*exp(x - 1))/100 - (1178002201*c^2*f*exp(x - 1))/6 - (138018436773*d^2*e*exp(x - 1))/80 - (51532025078445*d*f^2*exp(x - 1))/16 - (644111363199*d^2*f*exp(x - 1))/32 - (876063410205933*e*f^2*exp(x - 1))/20 - (30919810303923*e^2*f*exp(x - 1))/10 + a^3*x^3*exp(x) - (447*a*b^2*x*exp(x - 1))/4 + 6*a^2*b*x^2*exp(x) - (5221*a*c^2*x*exp(x - 1))/3 + 15*a^2*c*x^2*exp(x) - (892563*a*d^2*x*exp(x - 1))/16 + 48*a^2*d*x^2*exp(x) - (80434323*a*e^2*x*exp(x - 1))/25 + 195*a^2*e*x^2*exp(x) - (1179786123*a*f^2*x*exp(x - 1))/4 + 978*a^2*f*x^2*exp(x) + 242628*b*c*d*exp(x) + 1948164*b*c*e*exp(x) + 17901792*b*c*f*exp(x) + 16125516*b*d*e*exp(x) + 161510964*b*d*f*exp(x) + 130095204*c*d*e*exp(x) + 1681817136*b*e*f*exp(x) + 1409661276*c*d*f*exp(x) + 15791037732*c*e*f*exp(x) + 177725405940*d*e*f*exp(x) - (27*a^2*b*x^2*exp(x - 1))/2 - 37*a^2*c*x^2*exp(x - 1) - (501*a^2*d*x^2*exp(x - 1))/4 - (2613*a^2*e*x^2*exp(x - 1))/5 - (5295*a^2*f*x^2*exp(x - 1))/2 - (2638063*b*c*d*exp(x - 1))/4 - 5295635*b*c*e*exp(x - 1) - (97324157*b*c*f*exp(x - 1))/2 - (876673227*b*d*e*exp(x - 1))/20 - (3512258097*b*d*f*exp(x - 1))/8 - (707270753*c*d*e*exp(x - 1))/2 - (45716528721*b*e*f*exp(x - 1))/10 - (15327426191*c*d*f*exp(x - 1))/4 - (214622453951*c*e*f*exp(x - 1))/5 - (9662154824511*d*e*f*exp(x - 1))/20 + 42*a*b^2*x*exp(x) + 642*a*c^2*x*exp(x) + 20526*a*d^2*x*exp(x) + 1183614*a*e^2*x*exp(x) + 108504786*a*f^2*x*exp(x) - 825*a*b*c*x*exp(x - 1) - (15357*a*b*d*x*exp(x - 1))/4 - (108957*a*b*e*x*exp(x - 1))/5 - (36995*a*c*d*x*exp(x - 1))/2 - (292551*a*b*f*x*exp(x - 1))/2 - (593894*a*c*e*x*exp(x - 1))/5 - 891961*a*c*f*x*exp(x - 1) - (8040531*a*d*e*x*exp(x - 1))/10 - (26807721*a*d*f*x*exp(x - 1))/4 - 58988181*a*e*f*x*exp(x - 1) + 306*a*b*c*x*exp(x) + 1416*a*b*d*x*exp(x) + 8022*a*b*e*x*exp(x) + 6810*a*c*d*x*exp(x) + 53820*a*b*f*x*exp(x) + 43704*a*c*e*x*exp(x) + 328146*a*c*f*x*exp(x) + 295806*a*d*e*x*exp(x) + 2465520*a*d*f*x*exp(x) + 21700566*a*e*f*x*exp(x)
you can use subs() function to substitute specific values of these constants

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!