How to evaluate multiple definite integrals using the integral(F,min,max) function?
4 views (last 30 days)
Show older comments
I am trying to evaluate the integral of a function F using the integral(F,min,max) Matlab built-in function. The problem is that I want to evaluate the integral for a range of definition intervals (xmin,xmax), not just for one pair of values, and I get the "A and B must be floating point scalars" error message. I attached the code below:
% F(d) function definition
format long;
d = [1e-6:1e-7:1e-5];
F = (1./4)*(pi*pi*4e-7*(1.3e5)^2*(0.5e-6)^4)*(1./d.^2+1./(d+2*(0.67e-6)).^2-2./(d+(0.67e-6)).^2);
% F(d) plot
plot(d,F,'green', 'LineWidth', 2);
% Definite integral evaluation
F = @(d)(1./4)*(pi*mu0*M^2*R^4)*(1./d.^2+1./(d+2*H).^2-2./(d+H).^2);
dmin = [1e-6:1e-7:1e-5];
dmax = [1e-6+1e-7:1e-7:1e-5+1e-7];
L = integral(F,dmin,dmax)
What should I do in order to calculate the values of my definite integral for all the definition intervals ((1e-6, 1.1e-6), (1.1e-6,1.2e-6),..., (1e-5,1.01e-5))?
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Error Functions 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!