Hi This question is for a MATLAB course that I am enrolled i

Hi, This question is for a MATLAB course that I am enrolled in. I need the code for this question.

Write a function called light_speed that takes as input a row vector of distances in kilometers and returns two row vectors of the same length. Each element of the first output argument is the time in minutes that light would take to travel the distance specified by the corresponding element of the input vector. To check your math, it takes a little more than 8 minutes for sunlight to reach Earth which is 150 million kilometers away. The second output contains the input distances converted to miles. Assume that the speed of light is 300,000 km/s and that one mile equals 1.609 km.

Solution

------------------------------------------------------------------------------------------------------

Sample output:

dis is vector that contains distances

from earth to moon=384000

sun to earth=1.496e8

sun to mars=2.2794e8

--> dis = [384000 1.496e8 2.2794e8];
--> [time,distance]=light_time(dis)
time =
    0.0213    8.3111   12.6633
distance =
    617856 240706400 366755460

Hi, This question is for a MATLAB course that I am enrolled in. I need the code for this question. Write a function called light_speed that takes as input a row

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site