Computer Tools Exam
Q1. Create a script that will plot sin(3*t) and cos(3*t) for the 0 ≤ t ≤ 360 if the amplitude is more than 0.5 or less than -0.5.
Here are the required conditions.
(1) It should be in degrees not radians (You can use sine or cosine function for degrees or you can use the conversion formula between radians and degree (degree = radians X 180/pi)
(2) Any value of sin(3*t) and cos(3*t) between [-0.5, 0.5] should be replaced by zero.
(3) The graphs should have Titles, labels on x-axis and on y-axis. Also grid should be on.
(4) For the range of x-axis use 0 and 360. For the range of y-axis use -1.5 and 1.5.
(5) Use subplot to display two graphs in one plot.
In other words, create the following picture.
Q2. Create an m-function that will perform Matrix addition and Matrix Multiplication.
Here are the required conditions.
(1) Use 4 numbers as arguments. First and second numbers will become row and column number of the first Matrix. The third and fourth numbers will become row and column numbers of the second Matrix.
(2) If the dimension of the first Matrix is not equal to the dimension of the second Matrix, the computer WILL NOT perform the addition.
(3) ALSO, If the column number of the first Matrix is not equal to the row number of the second Matrix, the computer WILLNOT perform the multiplication.
(4) Once the dimension conditions are cleared, the user should be prompted to type in individual entries of the two Matrices.
Q3. (New) Create a script for the following problem.
An engineer had measured impedances of a collection of electrical components and created a text file - impedance.txt - based on the numerical data. You will find that impedance.txt on Canvas. The first Row of the file is MAGNITUDE of the impedance and the second Row is the PHASE (in radian), of the impedance. Column number indicates the number of components.
Here are the needed conditions.
(1) Will read the impedance.txt and find the Column number (You can use 'size' function)
(2) Compute real part and imaginary part of impedance of individual component.
(3) Save the result on a variable Impedance_Catesian.
(4) Save the result on a text file Impedance_Cartesian.txt
(5) Also have this following messago displayed on the screen ("There are ### components in the file impedance.txt. The Conversion of POLAR format of complex number into CARTESIAN format is completed and the result is saved on Impedance_Cartesian.txt")
(6) Do this with FOR LOOP OR WHILE LOOP (Only a single script is needed!)
Attachment:- Assignment Files.rar