Solution
MAE 8 Home Problem HW02(a)
2) The atomic weight is the weight of a mole of atoms of a chemical element. For
example, the atomic weight of oxygen O is 15.9994 and the atomic weight of silicon
Si is 28.085. Write a script that will calculate the mo
MAE 8  Spring 2015
Homework 4
Instructions: Follow the homework solution template. Put all answers in a MATLAB script
named hw4.m. For this homework, you will need to submit multiple les. Create a zip
archive named hw4.zip. The zip archive should include
MAE 8  Spring 2015
Homework 1
Instructions: Follow the homework solution template. Put all answers in a MATLAB
script named hw1.m. Submit hw1.m through TED before 9 PM on 04/09/2015. Use double precision unless otherwise stated.
Problem 1: Using the elem
MAE 8 Homework 5, Due February 13, 2013
February 7, 2013
1
Create an x vector that has integers 1 through 10, and set a vector y equal
to x. Plot this straight line. Now, add noise to the data points by creating a
new y2 vector that stores the values of y
MAE 8
 HW#1David T Zimmerman
A092789744
April 5, 2013
CHAPTER 1: problems; 2542
25) create the two vectors twice each. once using the colon operator and once linspace
> 1:10
ans =
1
2
3
4
5
6
7
8
9
10
5
6
7
8
9
10
> linspace(1,10,10)
ans =
1
2
3
4
> 2:5
MAE 8  Winter 2015
Midterm
FORM A
Instructions: Choose the best answer. Use #2 pencil. Completely fill the bubbles. Put your
name, your PID and the form (A or B) on your Scantron. Submit both the exam and
MAE 8
Solution to Midterm Examination 1, F 14
(Answers are in black font.)
1.(9%) Write down the output from the commands
a.) 3:2:12
3 5 7 9 11
b.) linspace(6,21,6)
6 9 12 15 18 21
c.) length(linspace(1,10)
100
2.(6%) Circle the letter of the correct stat
MAE 8
Solution to Final Examination Sp 13
1.) (20%) Circle choices or write answers in the following multiple choice questions. (Points are
deducted for wrong answers.)
a.) (2%) The commands " i=0;while i<=3 j=i*4; i=i+1; end; j " will give the result:
i.
MAE 8
Solution Midterm Examination 2, F 14
1.) (15%) Write a script that will ask the user to input rst and last names as separate strings and
then create and print a string consisting of a UCSD computer username, consisting of the rst
initial of the rst
MAE 8 Homework 6, Due February 21, 2013
February 15, 2013
1
A le called hightemp.dat was created some time ago that stores, on every
line, a year followed by the high temperature at a specic site for each month
of that year. For example, the le might look
Solution HW1 Exercises from Ch. 1 of Attaway
1) Create a variable to store the atomic weight of silicon (28.085).
> siliconAtWt = 28.085
siliconAtWt =
28.0850
2) Create a variable myage and store your age in it. Subtr
MAE 8: MATLAB Programming for
Engineering Analysis
Lecture 8
Hieu T. Pham
Spring 2015
Dept. of Mechanical and Aerospace Engineering
Announcement
! Homework 1 solution, grade, gradebreakdown are
posted on TED.
! Regrade: send request to TA Amit within 1 w
MAE 8  Spring 2015
Homework 2
Instructions: Follow the homework solution template. Put all answers in a MATLAB
script named hw2.m. Submit hw2.m through TED before 9 PM on 04/16/2015. Use double precision unless otherwise stated.
Problem 1:
a) Using the c
MAE 8
Solution to HW04(a)
Modified Problems from Chapter 3:
23) Whether a storm is a winter flurry, winter graupel, or blizzard is determined by
the snow fall. In inches, a storm is a winter flurry if the snow fall is
MAE 8: MATLAB Programming for
Engineering Analysis
Lecture 1
Hieu T. Pham
Spring 2015
Dept. of Mechanical and Aerospace Engineering
Teaching Staff
! Instructor:
! Hieu T. Pham (h8pham at ucsd dot edu)
! Office hour: Tuesday 1 2 PM EBU II 570
! Teaching A
MAE 8 F14 HW05
Modified Problems from Chapter 4
18) Assume that you have a matrix of integers mat. Fill in the rest of the fprintf
statement so that this would print the product of every row in the matrix, in the
forma
%atm.m
% simulation of ATM for HW JDG 04
%
% Rough scoring shown below
%
%logical test of correct password info., 20 percent
%check on username not asked for
%
load myatm
atest=false; %initialize logical tests
while atest=false
% user=input('Please enter
MAE 8  Spring 2015
Homework 6
Instructions: Follow the homework solution template. Put all answers in a MATLAB
script named hw6.m. For this homework, you will need to submit multiple les. Create a
zip archive named hw6.zip. The zip archive should include
David T. Zimmerman
A09278744
MATH 20F Matlab Assignment #5
Exercise 5.1
(a) List all maximal orthogonal subsets of the above set. What is the maximum
number of nonzero orthogonal vectors that you can find in R3? What about Rn?
Explain.
> dot(v,w)
ans =

HW03(a)
Modifications of Problems in Chapter 2:
24) Write a function called fn that will calculate x as a function of t, as follows:
x = t3 18t2 + sin(t)
Here are two examples of using the function:
> hel
Solution HW07(a)
Modification of Chapter 7 Problems
10) Write a script that will generate a random integer from 1000 to 2000, ask the
user for a field width, and print the random integer with the specified field width.
HW06
Modification of Problems from Chapter 5
13) Write a script that will read from a file oldfile.dat into a matrix. It will create a
square matrix (same number of rows and columns) by deleting successive rows or
columns as necessary, and then write this
Solution HW08(a)
Modification of problems in Chapter 9
1) Write a script that will read from a file x and y data points in the following
format:
z 0 y 1
z 4.6 y 2.2
z 6.8 y 6
z 8.1 y 7.4
The format of every line in the fil
MAE 8: MATLAB Programming for
Engineering Analysis
Lecture 5
Hieu T. Pham
Fall 2015
Dept. of Mechanical and Aerospace Engineering
Chapter 1 Topics
! Getting around MATLAB
! Useful commands
! Variables and expressions
! Data types
! Elementary functions
!
MAE 8: MATLAB Programming for
Engineering Analysis
Lecture 19
Hieu T. Pham
Fall 2015
Dept. of Mechanical and Aerospace Engineering
Announcements
! Optional homework 8 is due before 9 PM on
Monday 12/7.
! Project is due before 9 PM on Sunday 12/6.
! Projec
MAE 8: MATLAB Programming for
Engineering Analysis
Lecture 6
Hieu T. Pham
Fall 2015
Dept. of Mechanical and Aerospace Engineering
Announcements
! Homework 2 grades and solution are posted on TED.
! Send regrade request to TA Amit within a week from
today.
Name: Dan LaBruna
PID: A92143184
HW3PB24:
Solution:
function [ x ] = fn( t )
%Calculates x as a function of t
x = t*t*t  18*t*t + sin(t);
end
Results:
> help fn
Calculates x as a function of t
> x = fn(7)
x=
538.3430
HW3PB30
Solution:
%The BMI (Body Mas
MAE 8
Final Examination Sp 13
Open notes, closed book & no wireless communication
1.) (20%) Circle choices or write answers in the following multiple choice questions. (Points are
deducted for wrong answers.)
a.) (2%) The commands " i=0;while i<=3 j=i*4;
MAE 8: MATLAB Programming for
Engineering Analysis
Lecture 1
Hieu T. Pham
Fall 2015
Dept. of Mechanical and Aerospace Engineering
Teaching Staff
! Instructor:
! Hieu T. Pham (h8pham at ucsd dot edu)
! Office hour: Wednesday 1 2 PM EBU II 570
! Teaching A
MAE 8  Spring 2016
Final Exam
FORM A
Instructions: Choose the best answer. Use #2 pencil. Completely fill the bubbles. Put
your name, your PID and the form (A or B) on your Scantron. Submit both the exam
MAE 8  Fall 2015
Midterm Exam
FORM A
Instructions: Choose the best answer. Use #2 pencil. Completely fill the bubbles. Put your
name, your PID and the form (A or B) on your Scantron. Submit both the exam a
MAE 8  Winter 2015
Final Exam
FORM A
Instructions: Choose the best answer. Use #2 pencil. Completely fill the bubbles. Put your
name, your PID and the form (A or B) on your Scantron. Submit both the exam a
MAE 8  Fall 2015
Midterm Exam
FORM A
Instructions: Choose the best answer. Use #2 pencil. Completely fill the bubbles. Put your
name, your PID and the form (A or B) on your Scantron. Submit both the exam a