To plot a 3D plot in MATLAB and include it in LaTeX, you can use either the surf or the mesh function.
Here is an example code to plot a function of two variables and include it in LaTeX:
main.m481 chars21 lines
The code generates a surface plot of the function z=sin(sqrt(x^2+y^2))/(sqrt(x^2+y^2))
, adds labels and title, sets the axis limits, and exports it to LaTeX using the matlab2tikz
function.
To include the plot in LaTeX, simply add the following code to your LaTeX document:
240 chars9 lines
This code imports the my_3d_plot.tex
file generated by MATLAB, sets the figure height and width, and adds a caption and label to the plot.
gistlibby LogSnag