Integrating the following function using trapz method, while choosing a good step value (h = b-a/n ) to get enough accuracy and a fast result.
Afficher commentaires plus anciens

Hi guys,
So I am still a newbie at matlab, and I wrote this following code. But I am not sure on the step value I should pick for an accurate and fast result when integrating. Any help would be great, I have been tyring to figure it out for some time now. Thanks!
x = linspace(0,1,0.2);
y = (((sin(x)).^2)./x)-(x.*exp(2))-4;
z = trapz(x, y);
display(z)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Numerical Integration and Differentiation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!