compute numerical integral by matlab

2 views (last 30 days)
Hello everybody Please,I want to know,how compute integral from 2 to infinity for any function using matlab? thanks in advance

Accepted Answer

Matt Fig
Matt Fig on 7 Apr 2011
Put the function in an anonymous function, then use QUADGK.
  3 Comments
Matt Fig
Matt Fig on 7 Apr 2011
Don't put the keyword: function in a script or at the command line. Just do this:
y=@(X)(1/sqrt(2*pi))*exp(-0.5*X.^2); % Anonymous func.
Q=quadgk(y,2,inf)
reem
reem on 7 Apr 2011
Thank you so so so much
you are very kind and smart
I hope all best things for you
Kind regards

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!