Description
Solve all the following problems in MATLAB.
- Enter the following matrix A and create
- A 4 × 5 matrix B from the 1st , 3rd and 5th rows and 1st , 2nd , 4th and 8th columns of the matrix A.
- 16-elements row vector C from the elements of the 5th row and the 4th and 6th columns of the matrix A.
- Define 𝑎 𝑎𝑛𝑑 𝑏 as scalar 𝑎 = 0.75 and 𝑏 = 11.3 and 𝑥, 𝑦, 𝑧 as the vectors
𝑥 = [2,5,1,9, ], 𝑦 = [0.2, 1.1, 1.8, 2] and 𝑧 = [−3, 2, 5, 4], then evaluate
- Solve the following system of equations
2𝑥1 + 𝑥2 + 𝑥3 − 𝑥4 = 12
𝑥1 + 5𝑥2 − 5𝑥3 + 6𝑥4 = 35
−7𝑥1 + 3𝑥2 − 7𝑥3 − 5𝑥4 = 7
𝑥1 − 5𝑥2 + 2𝑥3 + 7𝑥4 = 21
- Plot sin2 𝑥, cos2 𝑥 𝑎𝑛𝑑 cos 2𝑥 on the same plot as well as subplots for 0 ≤ 𝑥 ≤ 2𝜋, in different styles.
- Consider the function 𝑧 = 0.56 cos(𝑥𝑦). Draw a surface plot showing variation of 𝑧 with 𝑥 and 𝑦. Given 𝑥 ∈ [0,10]𝑎𝑛𝑑 𝑦 ∈ [0,100]
- Write a function to find the gradient of 𝑓(𝑥, 𝑦) = 𝑥2 + 𝑦2 − 2𝑥𝑦 + 4 at (a) (1,1) and (b) (1, −2). Use the function name from command prompt as well as from a script file.
- Use symbolic toolbox to solve the following problems (a) Solve 𝑥7 − 8𝑥5 + 7𝑥4 + 5𝑥3 − 8𝑥 + 9 = 0
(b) Solve the ODE:
, then evaluate 𝐹′(𝑥) and 𝐹′′(𝑥).
- The population of X from the year 1930 to the year 2020 is given in the following table:
Year | 1930 | 1940 | 1950 | 1960 | 1970 | 1980 | 1990 | 2000 | 2010 | 2020 |
Population in million | 249 | 277 | 316 | 350 | 431 | 539 | 689 | 833 | 1014 | 1203 |
- Fit the data with a second-order polynomial. Make a plot of the points and the polynomial.
- Fit the data with linear and spline interpolations. Estimate the population in 1995 with linear and spline interpolations.