好吧,我尝试使用此代码进行矢量输出。只是一些我需要以矢量形式获得的功能
function [smthOut] = myErf(start, wstep, final)
for k = start:wstep:final
error_func = 2/sqrt(pi) * erfTaylor(k);
smthOut(final/wstep) = error_func;
disp(['ON x=', num2str(k), ' RES IS f= ', num2str(error_func)]);
end;
end
但输出看起来像这样
>> s = myErf(0, 0.2, 2)
ON x=0 RES IS f= 0
ON x=0.2 RES IS f= -0.0029732
ON x=0.4 RES IS f= -0.022959
ON x=0.6 RES IS f= -0.073171
ON x=0.8 RES IS f= -0.1606
ON x=1 RES IS f= -0.28568
ON x=1.2 RES IS f= -0.44374
ON x=1.4 RES IS f= -0.62745
ON x=1.6 RES IS f= -0.82906
ON x=1.8 RES IS f= -1.042
ON x=2 RES IS f= -1.2614
s =
Columns 1 through 8
0 0 0 0 0 0 0 0
Columns 9 through 10
0 -1.2614
穿什么?如何解决?谢谢!