A function related with speed light and time
이전 댓글 표시
Hello dear friends, I need to write a function called Ltime that takes as input a row vector of distances in miles and returns two output arguments. The first output argument is a row vector of the corresponding time in minutes for light to travel each distance, it takes light a little over 8 minutes to travel from the sun to the earth which are 92.9 million miles apart. The second output argument is a vector of the inputs in kilometers. The speed of light is 300,000 km/s and a mile is 1,609 km.
Also I should this code for getting the function: [a,b]=Ltime([10,100,1000,10000]). Thank you!
댓글 수: 1
Walter Roberson
2022년 12월 16일
Your code does not define A, B, C or D before the second line is executed . Are they functions that take no arguments? And then you overwrite the input M , and then you overwrite the four functions??
I am having trouble figuring out what anything in your function has to do with the assignment, with the exception that V=300000 looks like an approximation for the speed of light (which would normally be coded as c instead of V)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!