How to write a function of x in a function?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Angel Hiram Torres Mota
am 8 Mär. 2020
Kommentiert: Angel Hiram Torres Mota
am 8 Mär. 2020
Im just getting started in Matlab and I cant figure this out
I want to write a function of x and then the value of x inside a function
For example a = Evaluate((x^2)+1, 2)
And I want it to give me the answer. Which should be 5.
function [a] = Evaluate(f(x),x)
end
Thanks!
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 8 Mär. 2020
function a = Evaluate(f, x)
a = f(x);
end
Which might be called like
Evaluate(@(x) (x^2)+1, 2)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!