Solve integrals with Matlab
Afficher commentaires plus anciens
Hey guys i am working on a calculus problem and it requires me to use analytical solution, trapezoidal numerical integration, simpson's rule, lobatto quadrature and global adaptive quadrature. I keep getting errors and i have no idea what i am doing incorrect. Could someone help me write the code for this? Thanks.
Problem: f(x)= integral sign(5+1/sqrt(1-x^2)). Upper bound of integral sign is 1/2 and lower bound of integral sign is 0.
% Integrating using different commands
x=0:0.1:1/2;
y=(5+1/sqrt(1-x^2));
format long
% Analytical Solution
A0=(5+1/sqrt(1-x^2))
% Trapezoidal Numerical Integration
A1= trapz(x,y)
% Simpson's Rule
A2= quad('sqrt(1-x^2'x(1),x(end))
% Lobatto Quadrature
A3=quadl('sqrt(1-x^2'x(1),x(end))
% Global Adaptive Quadrature
A4=integral(intfun,x(1),x(end))
Réponse acceptée
Plus de réponses (2)
mohamed adel
le 26 Mai 2020
0 votes
∫_3^5▒〖1/√(x^2-4) dx〗
Sara
le 19 Mar 2024
0 votes
P(a,b)=1/√2π ∫_a^b▒〖e^((-x^2)/2) dx〗
Catégories
En savoir plus sur Numerical Integration and Differential Equations 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!