Borrar filtros
Borrar filtros

Solving integrals with Matlab

1 visualización (últimos 30 días)
Jerald Johnson
Jerald Johnson el 22 de Abr. de 2019
Respondida: JULIEN BARBAUD el 22 de Abr. de 2019
I am working on this problem which requires me to use the quadl command and the int command. I am doing the int command correctly but the quadl command keeps giving me an error. Could someone show me how to write the quadl command code correctly?
% Integrating using the quadl and the int command
int((sqrt(x)+1/x^2),x,1,9)
quadl('(sqrt(x)+1/x^2)',x,1,9)

Respuesta aceptada

JULIEN BARBAUD
JULIEN BARBAUD el 22 de Abr. de 2019
Please, check the documentation. It will tell you that you need a function handle as argument of qudl, not a character array.
Also note that the documentation warns you: quadl is not recommended. Use integral instead. So use at your own risks.
A one-liner for your purpose:
quadl(@(x) sqrt(x)+x.^(-2),1,9)

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by