2017-04-26 79 views

回答

2

肯定:

A='@(X) 10+(X(1)-2)^2+(X(2)+5)^2'; 
y=str2func(A); 
y([1 2]) 

刚刚变量A,而不是在第2行BTW test,为什么您使用str2func使用?这更直截了当:

[email protected](X) 10+(X(1)-2)^2+(X(2)+5)^2; 
y([1 2])