Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Help on double integral

1 visualizzazione (ultimi 30 giorni)
Natnael Hamda
Natnael Hamda il 5 Mar 2012
Chiuso: MATLAB Answer Bot il 20 Ago 2021
I wrote a simple code for evaluating a double integral of a function of the following but it does n't work;
R = 0.0067; D = 1.1111;
f = inline('exp(-R*(y-x))*((((y+D)/(x+D)))^(R*(K+D)+1))*(1/((y+D)*y)))','x','y');
dblquad(f,0,100,100,inf)
Any with a solution? Thanks for your time
  1 Commento
Walter Roberson
Walter Roberson il 5 Mar 2012
You have an extra ) at the end of the integral expression.

Risposte (1)

Walter Roberson
Walter Roberson il 5 Mar 2012
The above cannot be integrated, as it involves the undefined variable K .
  4 Commenti
Natnael Hamda
Natnael Hamda il 6 Mar 2012
Thanks a lot; The anonymous functions creates the function in better way. But still there is an error when i try to evaluate the double integral. I included the error message:
??? Error using ==> mldivide
Matrix dimensions must agree.
Error in ==> @(x,y)exp(-R*(y-x))*((((y+D)/(x+D)))^(R*(K+D)+1))*(1/((y+D)*y))
Error in ==> quad at 77
y = f(x, varargin{:});
Error in ==> dblquad>innerintegral at 78
Q(i) = quadf(intfcn, xmin, xmax, tol, trace, y(i), varargin{:});
Error in ==> quad at 77
y = f(x, varargin{:});
Error in ==> dblquad at 54
Q = quadf(@innerintegral, ymin, ymax, tol, trace, intfcn, ...
Mike Hosea
Mike Hosea il 8 Mar 2012
Your integral function must be able to accept arrays and return arrays. Don't use *, as this is matrix multiply. Instead use .*, elementwise multiplication. Similarly, don't use ^, rather .^. Don't use /, rather ./ . Basically, your integrand isn't working because it is being passed arrays, and it's trying to do matrix multiplications, matrix powers, and linear system solves when what you really just want is simple arithmetic, elementy-by-element.

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by