finding integration by using quad command

19 ビュー (過去 30 日間)
sibananda mohanty
sibananda mohanty 2012 年 11 月 7 日
function y =myfun(x) y=1/(x^3-2*x-5); Q=quad(@myfun,0,2)
after running this programme a get this error ??? Input argument "x" is undefined.
Error in ==> myfun at 2 y=1/(x^3-2*x-5);
please help to solve this programme

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2012 年 11 月 7 日
編集済み: Andrei Bobrov 2012 年 11 月 7 日
y=@(x)1./(x.^3-2*x-5);
Q=quad(y,0,2);
or
% function in m-file: myfun.m
function y =myfun(x), y=1./(x.^3-2*x-5); end
% use myfun function
>> Q=quad(@myfun,0,2)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by