- 6 名前:名無しさん@お腹いっぱい。 mailto:sage [2009/11/06(金) 11:02:54 ]
- test1.mで保存してOctave/MATLAB/FreeMATで実行
function F=test1() stol=0.0001; niter=50; AA=[0:360]; BB=AA./180.*pi; CC=cos(BB); x0=[1,0]; % if exist('verstring'), wt=zeros(size(BB))+1; [p1, f1] = fitfun(@sintest1, x0, CC, wt, eps, BB); p1 else [f1, p1] = leasqr(BB', CC, x0, @sintest2, stol, niter); p1 end; disp(sprintf('pi = %f', p1(2)*2)); function F=sintest1(param1, xx), F=sintest(xx, param1); function F=sintest2(xx,param1), F=sintest(xx, param1); function F=sintest(xx, param1), freq =param1(1); phase=param1(2); E=sin(xx.*freq+phase); F=E;
|

|