How do you create a composite function in matlab?
Ältere Kommentare anzeigen
If I have two functions, like
function a=func1(x)
and
function b=func2(q,p)
as examples. Is it possible to combine them to create a composite function like func1(func2(q)) = func1∘func2(q), and if so how do you do that?
3 Kommentare
Jiya
am 2 Mai 2023
if f(x)= X+5 and g(x)= x^2-3 then find (fog)(x), (gof)(x)
Torsten
am 2 Mai 2023
syms x
f(x) = ...;
g(x) = ...;
h1(x) = f(g(x))
h2(x) = g(f(x))
Walter Roberson
am 2 Mai 2023
Note: MATLAB does not have any explicit function-composition operator . For example Maple would allow you to write func1@func2(q) but MATLAB does not have any support for such an operator.
MATLAB does allow you to define
func1_o_func2 = @(x) func1(func2(x))
fplot(func1_o_func2, [-5 5]) %for example
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Number Theory finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!