From the course: Learning MATLAB

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Solution: Create a pyramid plot

Solution: Create a pyramid plot - MATLAB Tutorial

From the course: Learning MATLAB

Solution: Create a pyramid plot

- [Instructor] I hope you had enjoyed the challenge and you learned something. Let's take a look at how I would solve it. First, let's start by identifying the coordinates for this pyramid. So we'll start with point A (0,0,0), and then point B based on the dimensions of the pyramid will be at B (6,0,0), point C at (3,4,0,), and point D at (3,4,4). Now that we have the coordinates, let's go to MATLAB. Open a new script file. It is always a good practice to write a comment. For example, don't forget about the percentage symbol. This is a 3D plot of a pyramid. And next we are going to create the x, y, and z arrays. So x will be equal to 0 colon 6, and suppress the output, y will be equal to 0 to 4, and z will be equal to 0 to 4. And press Enter. We are going to use the patch command four times. Also to make sure that each face is visible, we will give each face a different color as mentioned in the challenge movie.…

Contents