0% found this document useful (0 votes)
85 views2 pages

MATLAB Midterm: Matrix, Vectors, and Plots

This document contains instructions for 4 MATLAB questions: 1. Generate a matrix using linspace and colon notation, take the inverse, and multiply rows. 2. Generate a vector using linspace and colon notation between given values. 3. Plot the standard normal probability density function between given values. 4. Implement an equation to calculate values of y and z as functions of x, where a and b are parameters, and plot the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views2 pages

MATLAB Midterm: Matrix, Vectors, and Plots

This document contains instructions for 4 MATLAB questions: 1. Generate a matrix using linspace and colon notation, take the inverse, and multiply rows. 2. Generate a vector using linspace and colon notation between given values. 3. Plot the standard normal probability density function between given values. 4. Implement an equation to calculate values of y and z as functions of x, where a and b are parameters, and plot the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

# MIDTERM_1 #

1. The following matrix is entered in MATLAB;

A = [linspace(7, 9, 3); 7 6 4; 0:1.5:4]

a) Write out the inverse of resulting matrix. (5 pts),

b) Use colon notation to write a single-line MATLAB command to multiply the


second row by the third column and assign the result to the variable D (5 pts).

2. The command linspace(a, b, n) generates a row vector of n, equally spaced points


between a and b. Use colon notation to write an alternative one-line command to generate
the same vector. Test your formulation for a = -15, b = 7, n =8,

a) with linspace (5 pts),

b) with colon notation (5 pts).

3. The standard normal probability density function is a bell-shaped curve that can be
represented as

1 −𝑧 2⁄
𝑓(𝑧) = 𝑒 2
√2𝜋

Use MATLAB to generate a plot of this function from z = -23 to 23. Label the ordinate as
frequency and the abscissa as z (10 pts).

4. The following equation can be used compute values of y as a function of x:

y = be-ax sin(bx)(0.008x4 – 0.13x3 + 0.175x2 + 2.6x)

where a and b are parameters.

a) Write the equation for implementation with MATLAB, where a = 2, b = 5, and x


is a vector holding values from 0 to π/3 increments of ∆x = π/55. Calculate the
vector of y. In addition, compute the vector z = y3 (15 pts).

b) Combine x, y, and z into a matrix w, where each column holds one of the
variables, and display w with 5 digits of floating-point (10 pts).

c) Generate a plot with sub-plots of (1) y versus x and (2) z versus x. Label,
ordinate name, abscissa name and title should be given (15 pts).

***You can submit your answers either as m files or pdf. If you submit as pdf, each code
and each result should be given in the file. If you submit as m file, you can submit one m
file for each question or a complete one-m file including all your answers with separate
sections for each question.

****Give your names to your submissions for example as:


Yeser_Aslanoglu.m
Yeser_Aslanoglu.pdf
Don’t use Turkish characters.

***Check your files before submit it if it runs or not. *** Be careful ***

GOOD LUCK!

You might also like