From: zucco on
Hi you all, I am a beginner of Matlab and I have a simple question:

I have a matrix, basically containing a peak signal in a certain position. For example

0 1 1 0 0
0 1 3 2 1
1 2 7 4 1
1 1 4 2 0
0 0 2 1 0

I need a function to fit this data in a gaussian curve (x,y -> z) and obtain the standard deviation of the gaussian peak

Can anyone help me please?
From: ImageAnalyst on
Use the regular formulas
In pseudocode which you can translate easily into MATLAB m-code:
mean_x = sumoverallelements(x * value) / sumoverallelements(value)
mean_y = sumoverallelements(y * value) / sumoverallelements(value)
Then just calculate the second central moment using the formula from
your textbook. Can you show us what you have so far?
From: zucco on
What I have is a Dicom image with almost every pixel with 0 value and a spot of gaussian shape. Thanks for the help I'll try (I was hoping there was a funtion to do it automatically...)
From: ImageAnalyst on
On Feb 13, 1:10 pm, zucco <fa...(a)gam42.it> wrote:
> What I have is a Dicom image with almost every pixel with 0 value and a spot of gaussian shape. Thanks for the help I'll try (I was hoping there was a funtion to do it automatically...)

There might be, depending on what you want to do. Do you want to
locate the centroid? You could use regionprops(), like in this
example:
http://www.mathworks.com/matlabcentral/fileexchange/25157
From: zucco on
It is everything ok now. Thank you for the advice