Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

K10765 Matlab 3D Mesh Plots

425 views

Published on

Basic coding for 3D plots

Published in: Engineering
  • Check the source ⇒ www.HelpWriting.net ⇐ This site is really helped me out gave me relief from headaches. Good luck!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

K10765 Matlab 3D Mesh Plots

  1. 1. *It is a high-level language for numerical computation, visualization and application development. *It also provides an interactive environment for iterative exploration, design and problem solving. •It provides vast library of mathematical functions for linear algebra, statistics, Fourier analysis, filtering, optimization, numerical integration and solving ordinary differential equations. *It provides built-in graphics for visualizing data and tools for creating custom plots. *MATLAB's programming interface gives development tools for improving code quality, maintainability, and maximizing performance. *It provides tools for building applications with custom graphical interfaces. *It provides functions for integrating MATLAB based algorithms with external applications and languages such as C, Java, .NET and Microsoft Excel. MATLAB
  2. 2. •Plotting in 3D and 3D data visualization is where Matlab’s power really becomes apparent! •Matlab defines a number of different kinds of 3D plots but you will probably find 3 or 4 to be the most useful: •x,y,z 3D line plot: plot3( ) •mesh plot: mesh( ) •surface plot: surf( ) •contour plot: contour( ) •combo surface/mesh with contour: surfc( ) •The surface plotting can also be applied to create realistic 3D objects by defining and plotting their exterior surfaces!
  3. 3. •It is often desirable to plot functions of the form: z=f(x,y) •for each (x,y), we can compute a value for z •this defines a surface in 3D space •If we can define (x,y) at regular intervals, Matlab provides powerful ways to plot the resulting function as a mesh or surface in 3D •The (x,y) values stored in arrays will define a grid of mesh points through which the surface will be created.
  4. 4. •3D plotting introduces several key concepts: •Meshes versus Surfaces •Hidden line removal •Pedestals and contours •Color maps and pseudo-coloring •Viewpoints and camera control (advanced!) •Shading and lighting (advanced)
  5. 5. Create a grid of x and y points points = linspace(-2, 2, 40); Y, Z) X, Y] = meshgrid(points, points); % Define the function Z = f(X,Y) Z = 2./exp((X-.5).^2+Y.^2)-2./exp((X+.5).^2+Y.^2); % Create the surface plot using the surf command figure surf(X, Y, Z)
  6. 6. % Create a grid of x and y data y = -10:0.5:10; x = -10:0.5:10; [X, Y] = meshgrid(x, y); % Create the function values for Z = f(X,Y) Z = sin(sqrt(X.^2+Y.^2)) ./ sqrt(X.^2+Y.^2); % Create a surface contour plor using the surfc function figure surfc(X, Y, Z) % Adjust the view angle view(-38, 18) % Add title and axis labels title('Normal Response') xlabel('x') ylabel('y') zlabel('z')
  7. 7. •Uses of 3-D plots in MATLAB •Well MATLAB is widely used as a computational tool in science and engineering encompassing the fields of physics, chemistry, math and all engineering streams. It is used in a range of applications including: • signal processing and Communications • image and video Processing • control systems • test and measurement • computational finance • computational biology

×