Please check the attachment and do all the questions as asked.I need this homework as (m.) file. Thank you.
Numerical and Computer Tools 1
1. Construct a row vector named ‘even’ containing even numbers from 2 to 34.
2. Construct a row vector named ‘threes’ containing every third number from 2 to 34.
3. Construct a row vector named ‘backward’ containing numbers starting at 22 to 5 by
4. Construct a row vector ‘evens’ with even numbers from 2 to 20. Construct a row
vector ‘odds’ with odd numbers from 13 to 31. Create vector ‘sumEvensOdds’ that is the
sum of vectors evens and odds. Create vector ‘productEvensOdds’ that is the array
product of vectors evens and odds.
5. Input a vector of radii (more than one) and a vector of heights and calculate a vector
containing the volume of the resulting cones. V= 3 ∗ ℎ ∗ 𝑝𝑖 ∗ 𝑟 2
Do not use the MATLAB functions or the matrix multiplication operator (*) or
transpose operator ( ‘ ) for the following problem. You can use * to multiply scalars.
6. Let a and b be three-dimensional vectors that are entered from input statements. Write
a MATLAB script that calculates: 1. the dot product between the two vectors; and 2. the
cross product a × b. Do not use the built-in MATLAB functions.
The output should be:
The dot product of [xx.xx, xx.xx, xx.xx] and [xx.xx, xx.xx, xx.xx] is xx.xx.
The cross product of [xx.xx, xx.xx, xx.xx] and [xx.xx, xx.xx, xx.xx] is [xx.xx, xx.xx,
The cross product of vectors (a1, a2, a3) and (b1, b2, b3) can be calculated as:
(a2b3 – a3b2)i + (a3b1 – a1b3)j + (a1b2 – a2b1)k or [(a2b3 – a3b2), (a3b1 – a1b3), (a1b2 – a2b1)]
7. Write a function that will calculate the volume of a barbell made of two spheres
connected by a bar. You will pass the radius of the spheres, the radius of the cylinder and
the length of the cylinder.
Write a program (script) that inputs the radius of the spheres, the radius of the cylinder
and the length of the cylinder and calls the function to calculate the volume. Display the
result in the script as “The volume of a barbell with two spheres of xx.x radius and a bar
of length xx.x with radius of x.xx is xxx.xx.”
Volume of sphere = 4/3*pi*r3
Volume of cylinder = pi*r2*height
Purchase answer to see full