Question: Challenge - 1 Built - in functions MATLAB provides numerous built - in variables and functions. For each line below, type the text in the
Challenge Builtin functions
MATLAB provides numerous builtin variables and functions. For each line below, type the
text in the Command Window and press to see what happens. Is the result what you
expect? Fill in the blanks below with the screen output for that line.
Variables, constants, and simple calculations:
a Look at the Workspace Pane: a VARIABLE called a has been created
a Look at the variables value in the Workspace Pane
b
ab
ans
y ans
x ;
y xx; z yy
Builtin functions:
sqrtx
pi a builtin variable
cospi
absans
abscospi
expans
mod Function rem is similar
help mod quick function reference
help rem
doc rem detailed function documentation
b
What does do
Its called the ellipsis
Challenge forloop
A forloop repeats the loop bodythe statements between the loop header and the end
keyworda predetermined number of times. The loop header is the line that begins with
the keyword for What does each loop below do Write in each blank the output from
executing the loop above.
for a ::
dispa
end
for b :
dispb
end
for c ::
dispc
CT: Introduction to Modelling
Assignment
end
for d ::
dispd
end
for f ::
dispf
end
for g ::
dispg How many times does the loop body execute?
end Any error message?
Challenge Vectors
a zeros
b ones What do the arguments specify?
c rand
d::
f::
g::
h What does the space separator do
m What does the comma separator do
n;; What does the semicolon separator do
pa h
qb; n
ra n ERRORmismatched dimensions! Attempt to concatenate a column to
a row
s b This operation is called "transpose"
ta b
u sumt What does function sum do
CT: Introduction to Modelling
Assignment
Challenge Determinant of a x matrix
Write MATLAB code, where x is a x matrix. Use the following formula:
Use the builtin function det to find the determinant of each times matrix. For
example, detm returns the determinant of times matrix m Then use the formula given above
to calculate the determinant of a times matrix. This question is all about practicing how to access
individual components or submatrices in a matrix. Recall that you can construct a matrix by
putting two row vectors one below the other or putting two column vectors side by side.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
