Integral of combined handle functions

2 Ansichten (letzte 30 Tage)
Tiago Araujo
Tiago Araujo am 24 Jun. 2021
Kommentiert: Star Strider am 25 Jun. 2021
I need to do a integral with a function by combining two functions, something like this:
syms q r
x(q,r) = q + 2*r;
y(q,r) = q*9 + r;
G = @(q,r) x+y
integral2(G,1,2,1,2)
It is only a example, my real problem is much more complex. How can i do that?

Akzeptierte Antwort

Star Strider
Star Strider am 24 Jun. 2021
Don’t use the Symbolic Math Toolbox for this.
Create ‘x’ and ‘y’ as anonymous functions instead, then call them in ‘G’:
x = @(q,r) q + 2*r;
y = @(q,r) q*9 + r;
G = @(q,r) x(q,r) + y(q,r);
G = function_handle with value:
@(q,r)x(q,r)+y(q,r)
Gint = integral2(G,1,2,1,2)
Gint = 19.5000
.
  2 Kommentare
Tiago Araujo
Tiago Araujo am 24 Jun. 2021
TKS
Star Strider
Star Strider am 25 Jun. 2021
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by