Octave Matlab Tutorial Part1 Essentials
Octave Matlab Tutorial Part1 Essentials
Problems
Which of the following are legitimate variable names in MATLAB? Test your answers
by trying to assign a value to each name by using, for example,
3vars = 3
or by using isvarname, as in
isvarname 3vars
2. global
3. help
4. My_var
5. sin
6. X+Y
7. _input
8. input
9. tax-rate
10. example1.1
11. example1_1
Predict the outcome of the following MATLAB calculations. Check your results by
entering the calculations into the command window.
13. 5-2*6+8^2/4*3*2
14. 5*6*4/2
15. 5/2*6*4
16. (6*6+8^2-4*5*5)/(3*7-2*5*2-1)
17. 5^(2*3)
18. 9*2^4^2*7
19. (6*3+8^2)/(4^2+2*10-18*2)
38. Newton’s law of universal gravitation tells us that the force exerted by one
particle on another is
m 1m 2
F = G
r2
Matrix Analysis
Create the following matrix A:
3.4 2.1 0.5 6.5 4.2
A = £ 4.2 7.7 3.4 4.5 3.9 §
8.9 8.3 1.5 3.4 3.9
40. Create a column matrix B by extracting and transposing the third row of
matrix A.
41. Create a matrix C by extracting the second row of matrix A.
42. Create a row matrix D of five elements between 1 and 9 using linspace
command.
43. Create a matrix F by extracting the values in columns 2, 3, and 4, and com-
bining them into a single column matrix.
44. Create a new matrix M by combining the matrices C' and D'.