From the course: Learning MATLAB

Unlock the full course today

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

Create 2D subplots

Create 2D subplots - MATLAB Tutorial

From the course: Learning MATLAB

Create 2D subplots

- [Instructor] So we can create multiple plots or graphs in one figure, but not with the same axis by using the subplot command. So the subplot command is subplot, and then you have to have m, n, and p, and I'm going to delete this, but this is just to explain what m, n, and p are in the subplot command. So m and n is the grid, how many subplot figures you can create, and then p represents the position of the respective subplot. So I'm going to delete this for now, and let me give you an example using a new script which we are going to save as subplot_example. Once we open the new script here, we are going to save this, and will be under Chapter 3 exercises, and this will be subplot example subplot_example and save. And we are going to save this again at the end. So let's start with the first subplot figure, so subplot command, and we are going to have four of them, so that means two by two, so 2,2, and then…

Contents