MATLAB Assignment 1
MATLAB Assignment 1
MATLAB Assignment 1
2. Using Pi: Given that you have a tesseract (the four-dimensional cube), calculate the
volume given that its side length, s, is equal to pi.
(Volume of Hypercubes: 𝑉 = 𝑠 𝐷 ; 𝑤ℎ𝑒𝑟𝑒𝐷𝑖𝑠𝑡ℎ𝑒𝑑𝑖𝑚𝑒𝑛𝑠𝑖𝑜𝑛𝑎𝑛𝑑𝑠𝑖𝑠𝑠𝑖𝑑𝑒𝑙𝑒𝑛𝑔𝑡ℎ)
5. Using “help” and Plotting Graphs: Read about the meshgrid and surf functions and
reference the built-in examples. This can be done by typing help surf or help meshgrid
Given that −𝟐. 𝟓 ≤ 𝒙 ≤ 𝟐. 𝟓 and −𝟐. 𝟓 ≤ 𝒚 ≤ 𝟐. 𝟓, use these functions to create a
surface plot for 𝒛 = 𝒔𝒊𝒏(𝒙𝟐 + 𝒚𝟐 ).Make sure you choose enough points for x and y to
make the curve smooth.
9. Graphing: Graph the following functions of the same plot and find the points of
intersection by zooming into the plot and hovering your cursor at the intersection. Make
sure you choose enough points to plot a smooth curve. Label the axes and add a plot title.
Use −𝟏𝟎 ≤ 𝒙 ≤ 𝟏𝟎. It might help to use ylim([-100,100]) when viewing.
𝒚𝟏 = 𝟓(𝒙 − 𝟓)𝟑
𝒚𝟐 = 𝟎. 𝟐𝒙 + 𝟑. 𝟖
𝒚𝟑 = (𝒙 − 𝟒)𝟐 + 𝟏
10. Values: Find the minimum and maximum of each matrix or vector below using built in
functions.
0
a. [ 2 ]
−1
1 0 −1
b. [0 1 −11]
9 10 1
1 9 10
c. [ ]
−5 11 0
11. Functions
a. Create a function that takes inputs “x”, “y”. The function outputs a matrix with
dimensionality x by y. The values of each element of this matrix will be calculated
by the equation (𝑥𝑖 + 𝑦𝑗 ), where 𝑖 represents the row number and 𝑗 represents the
column number of that element.
b. Create another function that takes in a generic input matrix “z”. Your function
outputs the maximum element value in z raised to the power of the minimum
element value in z.