Filter löschen
Filter löschen

finding integration by using quad command

1 Ansicht (letzte 30 Tage)
sibananda mohanty
sibananda mohanty am 7 Nov. 2012
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

Antworten (1)

Andrei Bobrov
Andrei Bobrov am 7 Nov. 2012
Bearbeitet: Andrei Bobrov am 7 Nov. 2012
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)

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by