Questions
1. Evaluate the following mathematical expression using MATLAB commands. Display your results by omitting semicolons at the end of your command lines.
1/4√52+ 62/3;
R = (8x3√x + 51/3x2)/x√x+41/3x2/3
where x = 3√(200 - 4√2 + 3(√99 - 3√5))
2. Solve the following system of equations using the MATLAB functions or operators:
2x-y+3z-t -3
x-2y-2z-3t = 2
5x -3y- z +2t = 3
3x-Fy+z+4t=7
Verify your solution using matrix multiplication.
3 Input the matrices
(a) Using MATLAB functions, verify that det(A) det(B) = det(AB) ;
(b) Calculate AB and 3ATB-1- 3B.
4 Write a MATLAB script to produce the graphs of the functions y1 = 2x-2 , y2 = x2 - 2 + 2 and y3 = -x3 in the range of -3:0.013 using the same axes. Use the MATLAB functions xlabel, ylabel.legend and title to annotate your graph clearly.
5. Use the surf function to plot z = x2/(1+y2), for, =-5:01 :5 and y =-5:0.1:5.
6. Write a MATLAB script to plot the piece-wise function of given by:
f(x) = 3x2 - Π2/4
f(x) = 4cosx + Π2 -Π/2 ≤ x ≤ Π/2
f(x) = x2 + Π2/4 x < -Π/2
x varies between -Π and Π with 100 data points.
7. For x = 1:10 calculate y = e0.2x, use fopen and fprintf to write x and y data into a file named "my ex_data . dat". Then use fopen and fscanf to read the x and y data. Show the data in 2 columns.
8. Write a MATLAB code using the switch statement to show whether a day of the week is a week day or weekend day. The day of the week is read in from the user as a string. Monday, through Friday are assumed to be week days and Saturday and Sunday are assumed to be weekend days.
9. We know that 1 - 1/3 + 1/5 -1/7 + = 1/4Π. How many terms do we need to have in order for the error to be smaller than 10-4? Write a MATLAB code to find out.
10. Write a MATLAB program that will display the numbers from 1 to 1000 which are cubic numbers (such as 8 = 2*2*2). The program should display: 1, 8, 27, .... Run your program and verify that it operates correctly.