Filter löschen
Filter löschen

Passing integral to another integral

1 Ansicht (letzte 30 Tage)
Matthew Leisten
Matthew Leisten am 5 Mai 2017
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."

Antworten (1)

Gautham Sholingar
Gautham Sholingar am 16 Mai 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:

Kategorien

Mehr zu Formula Manipulation and Simplification finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by