Three_D_plots.m - COURSE EE 115 Introduction to Computing for Engineers DESCRIPTION In-Class Example 3D Ploting AUTHOR Stephen Bruder DATE COMMENTS None

# Three_D_plots.m - COURSE EE 115 Introduction to Computing...

• 2

This preview shows page 1 - 2 out of 2 pages.

%% COURSE: EE 115 Introduction to Computing for Engineers % DESCRIPTION: In-Class Example: 3D Ploting % AUTHOR: Stephen Bruder % DATE: 10/31/2014 % COMMENTS: None clear all; close all; clc; %% A Plot3 Example z = 0:.1:10; x = exp(-0.2*z) .* cos(2*z); y = exp(-0.2*z) .* sin(2*z); plot3(x, y, z, 'r', 'LineWidth', 3) xlabel('x-axis'); ylabel('y-axis'); zlabel('z-axis') title('EGR115: A 3D Line Plot') grid % An Example % x = cos(t), y = sin(t), and z = sin(5*t) for 0 <= t <= pi t = 0:0.01:pi; x = cos(t); y = sin(t); z = sin(5*t); figure, plot3(x, y, z, 'r', 'LineWidth', 3) grid %% The 3D mesh Plot % A Simple Mesh 3D Example my_grid = [ 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 2 2 2 1 0 0 1 2 3 2 1 0 0 1 2 2 2 1 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0]; figure, mesh(my_grid,'LineWidth',2); % The 3D Sinc Function [X,Y] = meshgrid(-10:.5:10); R = sqrt(X.^2 + Y.^2) + eps; Z = sin(R)./R; figure, mesh(X,Y,Z) xlabel('x-axis'); ylabel('y-axis');

Subscribe to view the full document.

Unformatted text preview: zlabel('z-axis') title('The 3D Sinc Function') %% The 3D surf Plot % The 3D Sinc Function [X,Y] = meshgrid(-10:.5:10); R = sqrt(X.^2 + Y.^2) + eps; Z = sin(R)./R; figure, surf(X,Y,Z) xlabel('x-axis'); ylabel('y-axis'); zlabel('z-axis') title('The 3D Sinc Function') %% The 3D contour Plot [X,Y] = meshgrid(-10:.5:10); R = sqrt(X.^2 + Y.^2) + eps; Z = sin(R)./R; figure, contour(X,Y,Z) xlabel('x-axis'); ylabel('y-axis'); zlabel('z-axis') title('The 3D Sinc Function') %% Other 3D Plotting Functions % x = cos(t), y = sin(t), and z = sin(5*t) for 0 &lt;= t &lt;= pi t = 0:0.05:pi; x = cos(t); y = sin(t); z = sin(5*t); figure, stem3(x, y, z, 'r', 'LineWidth', 3) % A Simple Mesh 3D Example my_grid = [ 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 2 2 2 1 0 0 1 2 3 2 1 0 0 1 2 2 2 1 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0]; figure, stem3(my_grid,'LineWidth',2);...
View Full Document

• Fall '08
• DAVIDS

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes