Trouble Plotting 3D Graph with Two Variables and Matrix Data

In summary, the speaker is having trouble plotting their data using the plot3 function for a 3D graph. They have two variables ranging from 0 to 1 in 0.1 intervals and corresponding data points in an 11 by 11 matrix. They attempted to use the plot3 function with matrices for the x and z values, but the resulting figure did not look correct. The suggested solution is to use the ListPlot3D function with the data arranged in a specific format.
  • #1
jemma
36
0
I have 2 variables and data points corresponding to them and so would like to plot this (I think using the plot3 function for a 3D graph) but I'm having trouble writing my code.

Each variable ranges from 0 to 1 (in 0.1 intervals) and so this would be the x and z axis, and I have data points corresponding to each variable point in 11 by 11 matrix (which would be plotted on the y axis).

Since the data all has to be in matrices (or vectors) of the same size, I made my x and z values into matrices, and used this function:

plot3(z,y,x,'DisplayName','z,y,x');figure(gcf)

but the figure doesn't look right and I'm not sure what I'm doing wrong.

Please help!
 
Physics news on Phys.org
  • #2
Since you already have an 11x11 matrix of your z values you might try

ListPlot3D[Table[Sin[x]Cos[y], {x, 0, 2Pi, 2Pi/11}, {y, 0, 2Pi, 2Pi/11}]]

Compare that with

Plot3D[Sin[x]Cos[y], {x, 0, 2Pi}, {y, 0, 2Pi}]

and then try your own y data

ListPlot3D[y]

If you have version 7 and you can get your data in a form

tbl={{x1,y1,z1},{x2,y2,z2}...{x11,y11,z11}}

then you can try

ListPlot3D[tbl]
 

1. Why am I having trouble plotting a 3D graph with two variables and matrix data?

There could be several reasons for difficulty plotting a 3D graph with two variables and matrix data. One possibility is that the data is not in the correct format for plotting. Make sure the variables and data are properly organized and formatted in a table or matrix. Another reason could be that the software or program you are using does not support plotting 3D graphs with matrix data. Check the program's documentation or try using a different software.

2. How can I plot a 3D graph with two variables and matrix data?

To plot a 3D graph with two variables and matrix data, you will need to use a software or program that supports this type of graph. Some commonly used programs for scientific data visualization include MATLAB, Python's Matplotlib library, and OriginPro. Refer to the program's documentation or seek online tutorials for guidance on how to plot 3D graphs with matrix data.

3. Can I plot a 3D graph with more than two variables and matrix data?

Yes, it is possible to plot a 3D graph with more than two variables and matrix data. This type of graph is known as a multidimensional plot or a surface plot. However, it can be challenging to visualize and interpret data with more than three variables, so it is important to carefully consider the purpose and clarity of the graph before including multiple variables.

4. What are some tips for creating a clear and informative 3D graph with matrix data?

When creating a 3D graph with matrix data, it is important to choose an appropriate type of visualization. For example, a surface plot may be best for showing data with continuous variables, while a scatter plot or bar graph may be better for discrete or categorical data. It is also essential to label all axes and provide a clear, concise title for the graph. Use colors, textures, and labels to differentiate between different data points or categories.

5. How can I troubleshoot common issues when plotting 3D graphs with matrix data?

If you are experiencing issues when plotting 3D graphs with matrix data, here are some troubleshooting tips: 1) Make sure the data is properly formatted and organized in a table or matrix. 2) Check that the software or program you are using supports 3D graphing with matrix data. 3) Check for any missing or incorrect values in the data. 4) Experiment with different types of 3D graphs and color/label coding to better visualize the data. If you are still having trouble, consult the program's documentation or online resources for additional support.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
140
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
123
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
819
Back
Top