Passing integral to another integral
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
By no means am I a MATLAB expert. I'm trying to pass an integral to another integral, in an instance where there's no obvious way to write this as higher-dimensional integral. For instance, suppose I need to integrate the square of a finite integral:
f = @(x) sin(x).^2
g = @(x) integral(@(z)f(z),0,x)
h = @(x) integral(@(z)g(z).^2,0,x)
The problem I run into is that, to compute h, the limits of g are not scalars. The error message is: "A and B must be floating-point scalars."
0 comentarios
Respuestas (1)
Gautham Sholingar
el 16 de Mayo de 2017
A possible approach for this scenario is to use the functions available in the Symbolic toolbox to declare variables x,y,z and three functions which you can call with the specific integral limits. For example:
syms x y z % declare symbols
F = sin(x).^2;
G = int(F,x,0,y);
H = int(G^2,y,0,z);
subs(H,z,2)
The following documentation links explain these function in detail:
0 comentarios
Ver también
Categorías
Más información sobre Formula Manipulation and Simplification en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!