我有一个简单的八度音阶脚本
%! ## Example for linear inequality constraints
%! ## (see also the same example in 'demo nonlin_residmin')
%!
Ae = 1.5; ale = 0.1; omegae = 0.9 ; phie = 1.5;
noise = 0.1;
t = linspace(0,10,50);
n = noise*randn(size(t));
function y = f(t,p)
y = p(1)*exp(-p(2)*t).*cos(p(3)*t + p(4));
endfunction
y = f(t,[Ae,ale,omegae,phie])+ n;
plot(t,y,'+; data;')
% NOW try fit
A0 = 2; al0 = 0; omega0 = 1; phi0 = pi/2 ;
[fr,p] = leasqr(t,y,[A0,al0,omega0,phi0],'f',1e-10);
p
yFit = f(t,p);
plot(t,y,'+',t,yFit)
legend ('data','fit')
但是我在leasqr软件包中遇到错误 我已经安装了这些软件包
Package Name | Version | Installation directory
--------------+---------+-----------------------
optim | 1.5.2 | /Users/Terence/octave/optim-1.5.2
struct | 1.0.15 | /Users/Terence/octave/struct-1.0.15
>> testNonlinearfit
error: '__plot_cmds__' undefined near line 296 column 3
error: called from
leasqr at line 296 column 3
testNonlinearfit at line 16 column 7
非常感谢任何帮助