[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
octave-forge leasqr
From: |
Guanglei Cui |
Subject: |
octave-forge leasqr |
Date: |
Tue, 23 Mar 2004 16:16:14 -0500 |
User-agent: |
Mozilla Thunderbird 0.5 (Macintosh/20040208) |
Hi,
I just start to learn octave. I want to do some two variable regression
using leasqr provided by octave-forge. I tried to follow leasqrdemo, but
always got "undefined" error for the target function. Here's my script.
I appreciate for your suggestions.
##
function z = tors2(x,p)
z=p(1)*(1+cos(x(:,1)-p(2))) ...
+p(3)*(1+cos(x(:,1)*2-p(4))) ...
+p(5)*(1+cos(x(:,1)*3-p(6))) ...
+p(7)*(1+cos(x(:,2)-p(8))) ...
+p(9)*(1+cos(x(:,2)*2-p(10))) ...
+p(11)*(1+cos(x(:,2)*3-p(12)))
endfunction
c2c3=load torsion.c2-c3.dat;
c3ss=load torsion.c3-ss.dat;
diff=load diff.rel.dat;
## convert degrees to radians
c2c3=c2c3*pi/180;
c3ss=c3ss*pi/180;
x=[c2c3(:,2),c3ss(:,2)];
pguess=[1;0;1;0;1;0;1;0;1;0;1;0];
niter=50;
## dp=[0.1;0.1;0.1;0.1;0.1;0.1;0.1;0.1;0.1;0.1;0.1;0.1];
plot(diff);
global verbose;
verbose=1;
[f1, p1, kvg1, iter1, corp1, covp1, covr1, stdresid1, Z1, r21] = ...
leasqr (x, diff, pguess, tors2);
input("press a key to exit.");
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- octave-forge leasqr,
Guanglei Cui <=