函数文件
function y=fun1(x)
y=sin(x);
======================
function y=fun2(x)
y=cos(x);
====================
function y=fun3(x)
y=tan(x);
==========
建立3个m文件
x=1:4;
s=[];
for i=1:3;
funstr=str2func(['fun',num2str(i)]);
s(:,i)=funstr(x);
end
>> s
s =
0.841470984807897 0.54030230586814 1.5574077246549
0.909297426825682 -0.416146836547142 -2.18503986326152
0.141120008059867 -0.989992496600445 -0.142546543074278
-0.756802495307928 -0.653643620863612 1.15782128234958