help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: curve fitting


From: Kevin H. Hobbs
Subject: Re: curve fitting
Date: Thu, 02 Nov 2006 10:02:31 -0500

On Thu, 2006-11-02 at 14:23 +0000, hobbs wrote:
> I am a new user of Octave so I would appreciate some help.
> 
> I have an 2D array of values and I want to compute the mean/std for each row 
> as a function of column number by fitting a Gaussian distribution.
> 
> eg
> 
> 0  1  3  1  0  0  0  0 
> 0  0  1  2  4  3  1  1
> 0  0  0  1  9  2  0  0
> ....
> 
> to give a two column array (mean std)
> 3     0.2
> 5.2  1.0
> 5.0  0.05
> .....
> 
> 
> Is there a neat way either as a direct function call or as a script that this 
> can be achieved, please? 
> 
> Tnaksh
> Richard
> 

Read "help mean" and "help std". The 2s below tell mean and std to work
along rows.

octave:3> A=[0  1  3  1  0  0  0  0; 0  0  1  2  4  3  1  1;0  0  0  1
9  2  0  0]
A =

   0   1   3   1   0   0   0   0
   0   0   1   2   4   3   1   1
   0   0   0   1   9   2   0   0

octave:4> [mean(A,2) std(A,0,2)]
ans =

   0.62500   1.06066
   1.50000   1.41421
   1.50000   3.11677


Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]