Write Functions to Interleave Matrix Elements to compute Height and Velocity Using MATLAB
Question
a) In this problem, we will be computing the height and velocity of a ball when it is thrown vertically with an initial velocity from both Earth and Mars. For a given time t, the height reached is given by h = vt + 12 at2 and final velocity is determined by the equation vf = v + at (Consider that a = - g for both the equations in this problem). Implement these equations by defining two functions namely height and velocity where both these functions require Gravitational acceleration g, initial velocity v, time t as input parameters. The Gravitational acceleration on earth is 9.8 ms-2 and on mars is 3.7 ms-2, calculate the height and final velocity of the ball in both earth and mars for initial velocity of 10 ms-1 & time 1 second. Display your results.
b) Your task in this problem would be to write functions to interleave matrix elements. Your functions must accept matrices A and B as input, and the function InterRow would interleave the matrices row by row and the function InterCol would interleave column by column. Hence display the corresponding interleaved matrices for

Illustration of what your function should perform is shown in the example below:

Output of InterRow =
Output of InterCol =![]()
Note: The dimensions of A and B should be equal for interleaving. Do not interleave by manually entering the values, and your function should work for any dimensions of A and B (& not just 3x3).
Summary
This question belongs to MATLAB software and discusses about application of MATLAB in physics to write functions to interleave matrix elements to compute height and velocity of a ball when it is thrown vertically up.
Answer is in MATLAB format
