Integrating over integral error "A and B must be floating point scalars."
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have the following problem. I want to integrate over func2 while func2 itself is an integral over func1. The problem is that the boundary of the second integral is the integration parameter of the first one. This is the code:
func1 = @(x) x + 2;
func2 = @(y) integral(func1,0,y);
a = integral(func2,0,1);
Matlab tells me:
"Error using integral (line 86)
A and B must be floating point scalars."
Many thanks in advance for any help
0 Commenti
Risposta accettata
Andrei Bobrov
il 2 Giu 2013
Try
func1 = @(x) x + 2;
func2 = @(y) integral(func1,0,y);
a = integral(func2,0,1,'ArrayValued',true);
3 Commenti
Juan
il 24 Ago 2013
Hello, Is there any way to extend this to integral2? As far as I can tell, integral2 doesn't have the 'ArrayValued' option, is there anyway to get around it.
func1 = @(x) x + 2;
func2 = @(y) integral(func1,0,y);
a = integral2(func2,0,1);
Mic
il 2 Ago 2015
Integral2 doesn't have that property: http://www.mathworks.com/matlabcentral/answers/69288-integral2-and-array-valued-functions
you could integrate it twice: http://www.mathworks.com/matlabcentral/answers/127087-using-integral2-on-a-matrix-with-function-handler-components
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!