octave:2> S.nome='marco' S = scalar structure containing the fields: nome = marco octave:3> S.anni=30 S = scalar structure containing the fields: nome = marco anni = 30 octave:4> S.vettore=[1,2,3] S = scalar structure containing the fields: nome = marco anni = 30 vettore = 1 2 3 octave:5> polyfit([0,1],[0,1]) error: Invalid call to polyfit. Correct usage is: -- Function File: P = polyfit (X, Y, N) -- Function File: [P, S] = polyfit (X, Y, N) -- Function File: [P, S, MU] = polyfit (X, Y, N) Additional help for built-in functions and operators is available in the online version of the manual. Use the command 'doc ' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the help@octave.org mailing list. octave:5> polyfit([0,1],[0,1],1) ans = 1 -0 octave:6> x=linspace(-5,5,11); octave:7> y=1./(1+x.^2); octave:8> xbar=linspace(-5,5,101); octave:9> ybar=spline(x,y,xbar); octave:10> plot(x,y,'*',xbar,ybar) octave:11> octave:11> poly=polyfit(x,y,10) poly = Columns 1 through 5: -2.2624e-05 5.1946e-19 1.2670e-03 -2.5154e-17 -2.4412e-02 Columns 6 through 10: 3.3255e-16 1.9738e-01 -9.4723e-16 -6.7421e-01 2.4335e-16 Column 11: 1.0000e+00 octave:12> ybar=polyval(poly,xbar); octave:13> plot(x,y,'*',xbar,ybar) octave:14> spline(x,y) ans = scalar structure containing the fields: form = pp breaks = -5 -4 -3 -2 -1 0 1 2 3 4 5 coefs = 0.00621 -0.00823 0.02238 0.03846 0.00621 0.01041 0.02456 0.05882 0.00694 0.02905 0.06401 0.10000 0.10720 0.04987 0.14293 0.20000 -0.43573 0.37147 0.56427 0.50000 0.43573 -0.93573 0.00000 1.00000 -0.10720 0.37147 -0.56427 0.50000 -0.00694 0.04987 -0.14293 0.20000 -0.00621 0.02905 -0.06401 0.10000 -0.00621 0.01041 -0.02456 0.05882 pieces = 10 order = 4 dim = 1 octave:15> marco=spline(x,y); octave:16> marco.coefs ans = 0.00621 -0.00823 0.02238 0.03846 0.00621 0.01041 0.02456 0.05882 0.00694 0.02905 0.06401 0.10000 0.10720 0.04987 0.14293 0.20000 -0.43573 0.37147 0.56427 0.50000 0.43573 -0.93573 0.00000 1.00000 -0.10720 0.37147 -0.56427 0.50000 -0.00694 0.04987 -0.14293 0.20000 -0.00621 0.02905 -0.06401 0.10000 -0.00621 0.01041 -0.02456 0.05882 octave:17> ybar=ppval(marco,xbar); octave:18> plot(x,y,'*',xbar,ybar) octave:19> marco marco = scalar structure containing the fields: form = pp breaks = -5 -4 -3 -2 -1 0 1 2 3 4 5 coefs = 0.00621 -0.00823 0.02238 0.03846 0.00621 0.01041 0.02456 0.05882 0.00694 0.02905 0.06401 0.10000 0.10720 0.04987 0.14293 0.20000 -0.43573 0.37147 0.56427 0.50000 0.43573 -0.93573 0.00000 1.00000 -0.10720 0.37147 -0.56427 0.50000 -0.00694 0.04987 -0.14293 0.20000 -0.00621 0.02905 -0.06401 0.10000 -0.00621 0.01041 -0.02456 0.05882 pieces = 10 order = 4 dim = 1 octave:20> ybar=spline(x,[1,y,-1],xbar); octave:21> plot(x,y,'*',xbar,ybar) octave:22> plot(x,y,'*',xbar,ybar,xbar,(xbar+5)+1/26) octave:23> axis([-6,6,-2,2]) octave:24> spdiags([[1;2;3],[4;5;6],[7;8;9]],[-1,0,1],3,3) ans = Compressed Column Sparse (rows = 3, cols = 3, nnz = 7 [78%]) (1, 1) -> 4 (2, 1) -> 1 (1, 2) -> 8 (2, 2) -> 5 (3, 2) -> 2 (2, 3) -> 9 (3, 3) -> 6 octave:25> full(spdiags([[1;2;3],[4;5;6],[7;8;9]],[-1,0,1],3,3)) ans = 4 8 0 1 5 9 0 2 6 octave:26> spline([1,2,3,4],[2,3,5,6]) ans = scalar structure containing the fields: form = pp breaks = 1 2 3 4 coefs = -0.33333 1.50000 -0.16667 2.00000 -0.33333 0.50000 1.83333 3.00000 -0.33333 -0.50000 1.83333 5.00000 pieces = 3 order = 4 dim = 1 octave:27> spline([1,2,3],[2,3,5]) ans = scalar structure containing the fields: form = pp breaks = 1 3 coefs = 0.50000 0.50000 2.00000 pieces = 1 order = 3 dim = 1 octave:28> spline([1,2],[2,3]) ans = scalar structure containing the fields: form = pp breaks = 1 2 coefs = 1 2 pieces = 1 order = 2 dim = 1 octave:29> diary off