フィルターのクリア

How to evaluate multiple definite integrals using the integral(F,min,max) function?

6 ビュー (過去 30 日間)
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))?

採用された回答

Mike Hosea
Mike Hosea 2012 年 9 月 25 日
L = arrayfun(@(a,b)integral(F,a,b),dmin,dmax)

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by