How to plot uniform distribution by using surf() ?

Status
Not open for further replies.

shaq

Full Member level 5
Joined
Jul 23, 2005
Messages
311
Helped
14
Reputation
28
Reaction score
4
Trophy points
1,298
Activity points
3,397
matlab plot uniform distribution

Hi everyone,

I want to plot the theoretical uniform and normal distribution by using surf() in Matlab.

Can anyone help me to approach it?
 

Hey,

surf() is used to draw 3D surfaces in space, the uniform distribution can be drawn by only the 2D plot, so I think you mean you want it to be something like
z=(1/2πσ²)exp-((x²+y²)/2πσ²)

So it'll be this way for σ=0.3:

sigma=0.3;
X=-10:0.5:10;
Y=-10:0.5:10;
[x,y]=meshgrid(X,Y);
z=(1/2*pi*(sigma^2).*exp(-1.*((x.^2)+(y.^2))/(2*pi*(sigma^2))));
surf(x,y,z);
 

    shaq

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…