How to calculate integral of a function ?
Show older comments
Hello Friends, I am new for matlab, I want to calculate a integral but I don't know, how should I do it exactly. My matlab code is here:
_________________________________________________________________________________________________
clear all;
format long;
T = 0.6;
m = 3.00;
kmin = 1.0;
kmax = 10.0;
fun = @(k) k.^2/exp(sqrt(k.^2 + m.^2)/T) + 1;
q = int (fun,kmin,kmax);
_________________________________________________________________________________________________
When I execute the program I got error message:
*??? Undefined function or
method 'int' for input
arguments of type
'function_handle'.
Error in ==> nudenNccbar at 14
q = int (fun,kmin,kmax);*_ *
Please help me to short out the problem. Thank you.
Accepted Answer
More Answers (1)
Christopher Berry
on 5 Aug 2014
0 votes
The function name that you are looking for is integral not int. Changing this should get your code working. You can see the documentation for usage or examples here:
1 Comment
Captain Singh
on 6 Aug 2014
Categories
Find more on Numerical Integration and Differentiation 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!