EENG 1910: Project I – Learning to Learn
Assignment-7
1. What is MATLAB and what is it used for?
2. Research and provide an example of real-world applications that
MATLAB was used to implement.
Test your understanding of MATLAB with these short questions. Each
question should not require more than couple lines of commands or
explanation.
3. Given the matrix A = [3 8 4 5; 0 -1 -2 4; 3 8 4 75] run each of
the commands below and explain the observed result.
a. A’ b. A(10) c. A(3,1) d. A(3,:) e. A(:,2) f. A(:,[1:3]) g. A([1 3],[3 2]) h. [A;A(end-1,:)] i. A(:,[2 4 1 3]) j. A(1:2,:) = [] k. A(3:4,:) = [2:3:11;5:8] l. A(5,:) = zeros(1,4) m. sum(A) n. sum(A,2) o. [A;sum(A)] p. numel(A) q. B = reshape(A,1,numel(A)) r. [r,c] = size(A) s. length(A) t. [x,y] = size(B) u. length(B) v. help elfun
4. The colon (:) operator and linspace function are used in MATLAB
to create linearly spaced vectors. Observe the results of the
example provided using these two methods. Then, generate the
vectors below (a. b. c. and d.) using the colon operator and the
linspace function.
>> ls = linspace(3,15,5)
ls =
3 6 9 12 15
>> ls = 3:3:15
ls =
3 6 9 12 15
a. [1 2 3 4 5 6 7 8 9 10]
b. [9 7 5]
c. [-3 -6 -9 -12 -15 -18]
d. [1 3 5 7 9 3 6 9 12 15]
5. If a variable has the dimensions 5 x 1, could it be considered
to be (select all that apply):
a. a matrix?
b. a row vector?
c. a column vector?
d. a scalar?
6. If a variable has the dimensions 1 x 1, could it be considered
to be (select all that apply):
a. a matrix?
b. a row vector?
c. a column vector?
d. a scalar?
7. Create the two (2x2) matrices A and B define as follows:
A = [ 9 5 3 7
], B = [ 4 12 −8 1
]
a. Compute C1 = A + B and C2 = A – B and analyze how the operations are performed.
b. Compute the matrix products D1 = A*B and D2 = B*A. Are D1 and D2 the same? If not why?
c. Now, using element-wise multiplication (.*) compute D3 = A.*B and D4 = B.*A. Are D3 and D4 the same? If so why?
d. Is D1 = D3 and is D2 = D4? Why?
Type help input, help disp, help fprintf to learn more about the
MATLAB functions that are required to answer questions 8 and 9.
8. Create a MATLAB program that will ask (input) the user his/her
weight in pounds and convert the given value to kilograms. The
program should display (disp or fprintf) a statement in the
following form: ‘Your weight in kilograms is 100.’
Note that 1kilogram = 2.2pounds.
9. Create a MATLAB program that will ask a user for his/her first
name, his/her last name, and display the sentence: Your full name
is First Name Last Name. See the example below.
Enter your first name: Dak
Enter your last name: Prescott
Your full name is: Dak Prescott
Note: The input function works differently when asking the user
for a numerical value and when asking the user for a character or
string value.
10. What are the different types of design projects and what are
the characteristics of each one?
11. What are the questions that should be answered when
selecting a project?