Chapter 7 Rotation Matrice Example
7.1 Getting Started
Lets start by creating an empty script Start with the basic cleaning commands
clear;
clear
deletes all of the variables in your workspace - this makes sure that every time we run our code, we’re always using the data from this run of the script, and not a previous run.`
clc;
clc
deletes all of the old messages in the console or command window. This makes sure that the only messages we see on our command window come from this run of the script, and not from a previous run.
close all;
close all
closes all of the previous plots and graph windows. This way you know that the plots you see generated are new, and not old data.
Let’s load up our aircraft into Matlab
load Lab_Airplane.mat
Take a look at the new variables in your workspace
-file Lab_Airplane.mat who
The who
command prints a list of variables - in this case, we’ve asked it about the airplane_model file
Your variables are:
airplane f
7.2 Making an Airplane
Lets take a closer look at the airplane
variable
size(airplane)
ans = 1x2
36 3
Airplane is a 36 row by 3 column matrix. This variable represents the x, y, and z coordinates of every corner in our airplane model. There are 36 points within our airplane model.
airplane(1,:)
ans = 1x3
- 6.8000 0.5000 0.8000
The first point in our model occurs at the 3D point: -6.8 on the x-axis, 0.5 on the y-axis and 0.8 on the z-axis.
Let’s plot this