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.
