How to make an anonymous function whose variable is itself a function of another variable?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Salman
am 23 Mai 2014
Beantwortet: George Papazafeiropoulos
am 23 Mai 2014
Let's say i have an anonymous function defined in the following manner
z = @(x) cos(phi).^2 + 4*sin(phi).^2 and phi is defined in the following way
phi = @(x) x.^3 + 4*x.^2 + x +3
I have been trying to do this but when i call the function z in the following way, an error pops up
z(3)
Is something wrong in the syntax?
0 Kommentare
Akzeptierte Antwort
George Papazafeiropoulos
am 23 Mai 2014
z = @(phi) cos(phi).^2 + 4*sin(phi).^2
phi = @(x) x.^3 + 4*x.^2 + x +3
z(phi(3))
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements 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!