Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 matlab 完全陌生,我似乎找不到任何有关此的信息。我该如何实施?
function [R] = GetY(func,x) R = func(x); end; example: getY(5x+2, 1) R = 5(1)+2 = 7
使用function_handle:
function_handle
function R = GetY(func,x) R = func(x); end
...
>> GetY(@sin, pi/2) ans = 1 >> >> GetY(@(x) x.^2 + 4, 2) ans = 8