clear,clc
% Project 1
% Creates upper limit for the height
h_up = 47000;
h = 0:1000:h_up;
% Makes the height of each atmosphere
h_topo = 11000;
h_strat = 25000;
% for loop from i to h_up
for i = 1:length(h);
% Places values to the constants at Sea Level
T

3/1/16
MATLAB Basic Graphing
So far, we have used:
plot(x,y)!
Lecture 10
clf!
MATLAB :
xlabel!
Advanced Plotting Techniques
figure!
ylabel!
title!
legend!
grid!
AerE 161, Spring2016
hold
MATLAB Basic Graphing
MATLAB Basic Graphing
So far, we have used:
p

Aer E 161
Fall 2015
Extra Credit Problem 1
Due Wednesday, December 2, in lecture at 9am
This extra credit assignment is equivalent to one regular homework
Description:
Often in science and engineering it is necessary to fit data set (x,y) to a given funct

Aer E 161
Fall 2015
Homework and Exercises 6
Exercises (to be performed during the lab on Friday, October 16)
10.1, 6, 17, 23; 11.2, 13, 17; 12.5, 15, 19; 14.1, 2, 3, 9
Homework 6 (due Wednesday, October 21, in lecture at 9am)
Problem description:
There a

Aer E 161
Fall 2015
Homework and Exercises 9
Exercises (to be performed during the lab on Friday, November 13)
Attend the lab session and sketch several parts in SolidWorks under the guidance of the TAs.
Homework 9 (due Wednesday, November 18, in lecture

Aer E 161
Fall 2015
Homework and Exercises 1
Exercises (to be performed during the lab on Friday, September 4)
Last lab: 1.12, 14, 16, 20, 24, 29; and 2.1, 2, 3, 8, 11.
This lab: 2.7, 15, 16, 20, 26, 28, 37, 41, 42; and 3.1, 8, 10, 15, 18, 25, 27, 40.
Hom

Aer E 161
Fall 2015
Homework and Exercises 5
Exercises (to be performed during the lab on Friday, October 9)
6.3, 32, 35; 7.3, 16, 33, 37; 8.1, 13, 18, 24, 25; 9.2, 7, 9, 19, 21, 25, 28
Homework 5 (due Wednesday, October 14, in lecture at 9am)
Problem des

Aer E 161
Fall 2015
Homework and Exercises 2
Exercises (to be performed during the lab on Friday, September 11)
4.5, 8, 17, 26, 30, 31
Homework 2 (due Wednesday, September 16, in lecture at 9am)
Problem description:
Consider a quadratic equation of the fo

Aer E 161
Fall 2015
Homework and Exercises 7
Exercises (to be performed during the lab on Friday, October 23)
14.26, 27, 28, 30, 31, 34
Homework 7 (due Wednesday, October 28, in lecture at 9am)
Problem description:
Write the following sorting functions:
1

Aer E 161
Fall 2015
Homework and Exercises 3
Exercises (to be performed during the lab on Friday, September 18)
5.1, 5, 7, 9, 19, 23, 28, 29, 34, 36
Homework 3 (due Wednesday, September 23, in lecture at 9am)
Problem description:
Statistical analysis is w

Aer E 161
Fall 2015
Homework and Exercises 8
Exercises (to be performed during the lab on Friday, November 6)
14.37, 38, 43, 44, 45, 47
Homework 8 (due Wednesday, November 11, in lecture at 9am)
Problems:
1. Given the following 2 x 2 system of equations:

%Prom the user to input the coefficients
A = input('Enter the matrix A in bracket: ');
b = input('Enter the vector b in bracket: ');
n = size(A,1);
d = det(A);
if d = 0
%Check for the nonsingular
disp('No solution')
else
%Replace the vector b to each colu

lin_lsqfit.m
function [a,b]=lin_lsqfit(x,y);
% Calculate the matrix
S1 = sum(x);
S2 = sum(y);
for i = 1 : length(x);
A2 = x.^2;
AB = x.*y;
end
S3 = sum(A2);
S4 = sum(AB);
% Calculate the coefficient
a = (S2*S3-S1*S4)./(length(x)*S3-S1*S1);
b = (length(y)*

Lecture 2, ag 24m 2016.
Vectors and Matrices
A matrix is a rectangular array of numbers that is arranged
systematically in rows and columns. A matrix having n rows and m
columns is called an (n x m) matrix.
n m
1 3 5 $28
A: 2 4 6 5 3 3x3)
3 5 7 3'3 L
X=(1

ecture 6, 5919 12m 2016.
Control Flow in MATLAB
There are occasions that we want to repeat a segment of code a
number of different times.
Loops
- For - Loop
- While - Loop
Loops with iteration variable: For-Loops
We use For-Loop when we know in advance ho

. , n ,
Lecture 8, 5ep.26 12016.
Strings
Strings are arrays (vectors) with character elements.
String constants are enclosed in single QUQIQL
Characters include letters of the alphabet, digits, punctuation marks,
white space, and control characters:
. Con

Lecture 14, Oct 26m 2016.
Interpolation and Curve Fitting.
What is the velocity of the rocket at t: 15 sec
and at t = 55 sec?
mu"-
315.6 712.83 2001 3338.27
0
/
V;ZE
s 0, M135
3000E gvji:%
2500; ac /
2000? X 0/ 4 76? MVP?
1500; / I" ) F394*L
1000;

Lecture 15, Oct 31 2016.
Chapter: Curve Fitting.
Least Squares Approximation
Vhe Least Squares Method is more suitable for experimental data
than polynomial interpolation methods.
The idea of the Least Squares A o roximation is to minimize the sum
(over a

Lecture 7, Sep 21 2016
User-Defined Functions
User defined MATLAB functions are written in M-les. Access a
new function M-file the same way a script M-file is created: select
File > New > mfile from the menu bar.
There are several advantages to splitting

th
Lecture 12, Oct 17 2016.
Chapter: Systems of Linear Equations (:59
Consider the system of n linear algebraic equations:
' 0.1 X] +0-IZX2_+ QISX5 + 301., Kr. : B!
0.2. Kl +QZLXL+ QZSI$+-v- *LLZhXh-; 61
ahuxt +anzxz'a$x$+"'+a'xn= 6')
when :1; - woman/ts

Lecture 9 , Oct 3M2016.
File Input/Output (l/O)
If ,a file has the same number of values on every line, and the same
type, Wan be used to read from the file into a matrix.
load Filename.ext V
(extension is either .dat or .txt)
Similarly, "_j gig can be us

ectu1e 5, Se? 7m 2016.
Conditional constructions (lf-then-else).
Comparison Operators
MATLAB
i Q r (a col/
i_equality Pi/10?
= W
tiered WV") -
5 MW)
greater or equal :
The resulting type is logical_ 1 for true or 0 for false.
The if statement I

ectu1e 4, Aug 31St 2016
Algorithms
yAn algorithm is the sequence of steps needed to solve a problem
Top-down design approach to programming: break a solution
into steps, then further refine each one.
Generic algorithm for many programs:
-P 0M? (1',st
A

ecture 16, Nov 2nd2016.
Chapter: Numerical Differentiation.
Numerical differentiation is useful in estimating the derivative of a
function when either function f(x) is difficult to differentiate easil , or it
is not known as an explicit expression in x, b

Aer E 161
Fall 2015
Homework and Exercises 4
No specific exercises this week since Test 1 will be taken during the lab time.
Homework 4 (due Wednesday, September 30, in lecture at 9am)
Problem description:
One way to calculate the square root of the numbe

clear,clc
% Enter values for dimensions
% Change cm to in if needed
L = input('enter the length of the base')
Ld = input('Is that i or c?','s')
if Ld = ' c'
L = L / 2.54
end
W = input('enter the width of the base')
Wd = input('Is that i or c?','s')
if Wd

Lecture 28, Apr 9mL 2014.
Chapter: Numerical Differentiation
Two-point Formula.
To nd the approximation of the first derivative of a function at a
given point, consider two distinct points x0 and x1,
x. X.=X~+h
The linear Lagrange interpolating polynomi