필터 지우기
필터 지우기

Solving integrals with Matlab

조회 수: 1 (최근 30일)
Jerald Johnson
Jerald Johnson 2019년 4월 22일
답변: JULIEN BARBAUD 2019년 4월 22일
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)

채택된 답변

JULIEN BARBAUD
JULIEN BARBAUD 2019년 4월 22일
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)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by