Passing integral to another integral
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Gautham Sholingar
2017 年 5 月 16 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!