This example demonstrates a way to have different x and y ranges. Hold off %%%%% DON'T FORGET TO HOLD OFF!! %%%%% Another 3D Surface Example Title( '3D Plot Example of multiple graphs') Again, you may need to adjust how many points are used to make the graph not too jagged (if number too low) or not hang the computer (number too high). Notice in this example we used a different way to get the domain for x,y using linspace as opposed to the above example. This example demonstrates how to plot more than one graph on the same figure. The ZLIM command changes the range of the z-axis shown (you can likewise use XLIM and/or YLIM). We could have equally used the following command mesh(x,y,z) % check out the difference in the graphs! Adding axes labels, titlesĬAREFUL! One of mesh and surf may be more appropriate for different graphsįollowing labels the axes and creates a title mesh(x,y,z) You don't want too few points in the "grid" or it will appear jagged, but too many and the computer will slow down or even hang! xd=linspace(-1,1) The meshgrid command is vital for 3D surfaces!ĭefining the domain here is even trickier than for 2D. This example shows one way to plot 3D surfaces. The main commands are mesh(x,y,z) and surf(z,y,z) Calculate z for the surface, using component-wise computations.Create a "grid" in the xy-plane for the domain using the command meshgrid.Establish the domain by creating vectors for x and y (using linspace, etc.).It is up to you to experiment and look up these commands to better understand them. I do not explain every command or show everything. This page will not show all of them it will show the way that is the most customizable and can be easily extended to more complicated settings (like parametric equations, 3D, etc.) This is also a learn-by-example page. There are several ways to produce graphs of functions. There are many other examples on the H-drive! You may want to have the following commands at the top of your script files to "start fresh" clc % clears the command windowįormat % resets the format to the default format Combining vector functions and surfaces.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |