You are on page 1of 2

Royal University of Phnom Penh CG: Lab 3

Faculty of Engineering Lecture: Kor Sokchea

Lab 3:
In this lab, you are required to write functions to perform operations in vector and matrix that
we learned in the previous lecture. Moreover, you will enhance your application that you have
done in Lab 2 by drawing a sin wave.

Required Tasks:
Bronze Challenge:
 Write a method named preMultiply to multiply row vector with matrix

 Write a method named postMultiply to multiply column vector with matrix

 Create a method named nagateVector to do vector negation

 Create a method named multiplySclarWithVector to multiply row vector


with matrix

 Create a method named addVector to perform addition of two vectors

 Write a method named substractVector to perform substraction of two


vectors

 Write a method named computeMagnitude to find the magnitude of vector

 Write a method named normalize in order to get normalized vector or unit


vector

 Write a method named dotProduct to calculate dot product between two


vectors

 Write a method named crossProduct to calculate cross product between two


vectors

 Write a method named transpose to convert from row to column vector or


vice versa
Royal University of Phnom Penh CG: Lab 3
Faculty of Engineering Lecture: Kor Sokchea

Silver Challenge: Plot sin wave with the following formula

𝑨 𝐬𝐢𝐧⁡(𝝎𝒕 + 𝝋)
𝑨 : Amplitude
𝝎 : Frequency
𝝋 : Phase

Gold Challenge: Automatically scale the unit in order to fit the data

You might also like