Sep 29, 2005 #1 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?
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?
Sep 30, 2005 #2 E elmolla Full Member level 2 Joined Jul 14, 2005 Messages 132 Helped 20 Reputation 40 Reaction score 2 Trophy points 1,298 Activity points 2,721 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);
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);