[Pkg-octave-devel] Bug#348480: sample data

Thomas Weber thomas.weber.mail at gmail.com
Sun May 21 13:44:53 UTC 2006


Using your data file, I get:

$ cat v.m
clear all
inputData = load( "test.dat" );
x = inputData( : , 1 );
y = inputData( : , 2 );
P = polyfit(x,y,10);
ynew = polyval(P,x);

$ cat test.dat
-1196.4 315571.7086
-1195.2 315575.9618
-1194   315579.4195
-1192.8 315582.6206
-1191.6 315585.4966
-1190.4 315588.3172
-1189.2 315590.9326
-1188   315593.5934
-1186.8 315596.0455
-1185.6 315598.4201
-1184.4 315600.7143
-1183.2 315602.9508
-1182   315605.1765


So v.m has your commands and test.dat is your data file. Now, running
v.m, I get

octave:2> norm(y-ynew)
ans = 6.3300

While Matlab's result is slightly better (norm of difference is ~0.4), I
don't see the results to differ that much? Oh, and Matlab warns about
the polynomial being badly conditioned.

	Thomas 






More information about the Pkg-octave-devel mailing list