Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Gaussian Plot

Subject: Gaussian Plot

From: Model Ramachandran

Date: 31 Aug, 2009 05:11:00

Message: 1 of 3

Hi,

I am using following code to plot Gaussian 3D Plot.

I have a Histogram Plot data ,I would like to plot into 3D gaussian plot.
Trans_M=0.103530306095839
                        ........
              0.103215731326003
              0.100153744235321 (50*1) matrix
Kindly any one tell me whats wrong in the code...

[x,y]=meshgrid(-5:0.2:5,-6:0.2:6);
 z=Trans_M;
        surfl(x,y,z);
        hold on;
        contourz(x,y,z,'',-2);
        contourz(x,y,z,[0.01 0.05 0.1 0.13],3);
        hold off;

Subject: Gaussian Plot

From: arun

Date: 31 Aug, 2009 09:19:46

Message: 2 of 3

On Aug 31, 7:11 am, "Model Ramachandran" <selvakumar....@gmail.com>
wrote:
> Hi,
>
> I am using following code to plot Gaussian 3D Plot.
>
> I have a Histogram Plot data ,I would like to plot into 3D gaussian plot.
> Trans_M=0.103530306095839
>                         ........
>               0.103215731326003
>               0.100153744235321  (50*1) matrix
> Kindly any one tell me whats wrong in the code...
>
> [x,y]=meshgrid(-5:0.2:5,-6:0.2:6);  
>  z=Trans_M;
>         surfl(x,y,z);
>         hold on;
>         contourz(x,y,z,'',-2);
>         contourz(x,y,z,[0.01 0.05 0.1 0.13],3);
>         hold off;

your error most probably is because u are plotting using surf with 'z'
which is a 50*1 vector, where as, x and y are matrices.
Btw, did you mean 3D plot or 3D Gaussian plot??
If you want a Gaussian function then I guess your Z should be
generated as,
z = exp(-((x.^2/2/s1/s1) + (y.^2/2/s2/s2))); where s1 an s2 are the SD
respectively.

then use surf(x,y,z). remember when you use surf, z = f(x,y). which
has to be of the same dimensions.
see doc surf for more information.

hope this helps.
best, arun.

Subject: Gaussian Plot

From: Model Ramachandran

Date: 1 Sep, 2009 02:33:04

Message: 3 of 3

Hi,

Thanks for your mail.

I would like to plot 2 Gaussian in one graph...

Its similar to
http://www.mathworks.com/matlabcentral/fx_files/16053/1/loi_multimodale.jpg

The code doent contain any documentation,Just I would like to plot one 3D Gaussian . Using my data I can plot Histogram I would like to convert into gaussian profile.

Thanks


arun <aragorn168b@gmail.com> wrote in message <c6210bf0-0318-4783-ac55-c0e51a9686d7@k26g2000vbp.googlegroups.com>...
> On Aug 31, 7:11?am, "Model Ramachandran" <selvakumar....@gmail.com>
> wrote:
> > Hi,
> >
> > I am using following code to plot Gaussian 3D Plot.
> >
> > I have a Histogram Plot data ,I would like to plot into 3D gaussian plot.
> > Trans_M=0.103530306095839
> > ? ? ? ? ? ? ? ? ? ? ? ? ........
> > ? ? ? ? ? ? ? 0.103215731326003
> > ? ? ? ? ? ? ? 0.100153744235321 ?(50*1) matrix
> > Kindly any one tell me whats wrong in the code...
> >
> > [x,y]=meshgrid(-5:0.2:5,-6:0.2:6); ?
> > ?z=Trans_M;
> > ? ? ? ? surfl(x,y,z);
> > ? ? ? ? hold on;
> > ? ? ? ? contourz(x,y,z,'',-2);
> > ? ? ? ? contourz(x,y,z,[0.01 0.05 0.1 0.13],3);
> > ? ? ? ? hold off;
>
> your error most probably is because u are plotting using surf with 'z'
> which is a 50*1 vector, where as, x and y are matrices.
> Btw, did you mean 3D plot or 3D Gaussian plot??
> If you want a Gaussian function then I guess your Z should be
> generated as,
> z = exp(-((x.^2/2/s1/s1) + (y.^2/2/s2/s2))); where s1 an s2 are the SD
> respectively.
>
> then use surf(x,y,z). remember when you use surf, z = f(x,y). which
> has to be of the same dimensions.
> see doc surf for more information.
>
> hope this helps.
> best, arun.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us