1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab 3D problem

  1. Mar 30, 2008 #1
    1. The problem statement, all variables and given/known data
    Hi all! I'm trying to solve the following problem but I'm not too sure of a few things.
    Write Matlab instructions to plot a three dimensional Gaussian:

    A = A0exp((x^2 + y^2 + z^2)/w^2)

    choosing appropriate values for A0,w and range of coordinates.

    2. Relevant equations
    I'm guessing i have to use the plot3 command but after that I'm lost

    3. The attempt at a solution
    I dont know how to choose appropriate values for all of the variables.And what is w?
    I'm a bit lost so I'd really appreciate any hints or tips to point me in the right direction thanks debs:smile:
  2. jcsd
  3. Mar 31, 2008 #2
    w is a parameter of your Gaussian, make it bigger and the distribution should flatten out.

    What exactly do you want to plot? You can't plot A(x,y,z) on a 3D plot because A depends on 3 variables so you would need a 4D plot.

    If you want to plot a Gaussian distribution of 2 variables, run the following code in Matlab:
    Code (Text):

    pts = -5:.1:5;
    N = length(pts);
    X = reshape(repmat(pts,1,N),N,N);
    Y = reshape(repmat(pts,N,1),N,N);
    Z = exp(-X.^2-Y.^2);
    Is that the type of plot you are trying to produce?
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Matlab 3D problem
  1. Matlab 3D Scatter Plot (Replies: 4)

  2. 3D modelling in MATLAB (Replies: 2)

  3. 3D plot using Matlab (Replies: 1)

  4. 3D Z-Transform Matlab (Replies: 3)

  5. MATLAB, 3D plotting (Replies: 1)