I want to integrate this function

9 vues (au cours des 30 derniers jours)
khaled Abdelghafar
khaled Abdelghafar le 20 Mar 2022
x=0:50;
y=exp(-x./25).*sqrt((25+x)/(25-x));
int(y,x,0,50)
i want to integrate this function

Réponse acceptée

Star Strider
Star Strider le 20 Mar 2022
Use the integral function —
x = 0:50;
y = @(x) exp(-x./25).*sqrt((25+x)/(25-x));
int_y = integral(y,0,50)
int_y = 0.0000 + 21.6166i
The cumtrapz (or trapz) function is another option:
x = 0:50;
y = @(x) exp(-x./25).*sqrt((25+x)/(25-x));
int_y = cumtrapz(x,y(x));
figure
plot(x, real(int_y), x,imag(int_y))
grid
legend('Real','Imaginary', 'Location', 'best')
.

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by