Write this code in MATLAB.
1. As of early 2018, Usain Bolt holds the world record in the men's 100-meter dash. It is 9.58 seconds. What was his average speed in km/h? Assign the result to a variable called hundred.
2. Kenyan Eliud Kipchoge set a new world record for men of 2:01:39 on September 16, 2018. Assign his average speed in km/h to the variable marathon. The marathon distance is 42.195 kilometers.
Expert Answer

14 件のコメント

David Hill
David Hill 2020 年 4 月 10 日
What have you done?
vmnf kfnk
vmnf kfnk 2020 年 4 月 10 日
whats wrong with code
distance1=100; time1=9.58; hundred=distance1*18/(time1*5); disp(hundred); distance2=42.195*1000; time2='2:01:39';
Walter Roberson
Walter Roberson 2020 年 4 月 10 日
Assign his average speed in km/h to the variable marathon.
You did not do that.
You will be wanting to convert time2 into hours. If you have one of the most recent versions of MATLAB, that is easily done by combining duration() with hours()
vmnf kfnk
vmnf kfnk 2020 年 4 月 10 日
Can you answer this question to me, please solve my problem, I need answer code
Rik
Rik 2020 年 4 月 10 日
This is your homework. These are fairly basic Matlab instructions: assign something to a variable with a specific name. If you don't know how to do this, go back to the explanation you got before this question. If it did not explain this you should do a basic Matlab tutorial.
Walter mentioned two functions you could use to convert '2:01:39' to decimal hours. Have you read the documentation of these functions? The Matlab documentation is very good, it is one of the key advantages over competitors like Python and GNU Octave. You should really try using it to understand what a function does.
vmnf kfnk
vmnf kfnk 2020 年 4 月 10 日
Finally, I solved this question
vmnf kfnk
vmnf kfnk 2020 年 4 月 10 日
Thanks for all
Shashank Mahajan
Shashank Mahajan 2020 年 4 月 15 日
how plz help?vmnf kfnk
Walter Roberson
Walter Roberson 2020 年 4 月 15 日
Speed is distance divided by time. The required output is km/h so first convert the distance to kilometer and the time to hours.
Nadya Shahin
Nadya Shahin 2020 年 7 月 20 日
how come the distance1*18/(time1*5)? what's the meaning of 18 and 5?
Walter Roberson
Walter Roberson 2020 年 7 月 20 日
18/5 is 3.6 which is 3600 seconds divided by 1000 metres per kilometre
Ashish Kumar
Ashish Kumar 2021 年 1 月 15 日
%Converting distance in kilometers
distance1 = 100/1000;
%Converting time in hours
time1 = 9.58/3600;
%Calculating speed
hundred = distance1 / time1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
distance2 = 42.195;
%Calculating and Converting time in hours
time2 = (121*60+39)/3600;
%Calculating speed
marathon = distance2 / time2
Abdulrahman  Farouq
Abdulrahman Farouq 2022 年 1 月 18 日
Thx so much

サインインしてコメントする。

 採用された回答

vmnf kfnk
vmnf kfnk 2020 年 4 月 27 日

2 投票

y=0.1/9.58;
hundred=y*3600
x=42.195/((121*60)+39);
marathon=x*3600

3 件のコメント

Priya  Dwivedi
Priya Dwivedi 2020 年 5 月 11 日
編集済み: Walter Roberson 2020 年 5 月 11 日
Rik
Rik 2020 年 5 月 11 日
編集済み: Rik 2020 年 5 月 11 日
I guess because 100 meter is 0.1 kilometer, but this is the problem with undocumented code.
Edit: the original comment by Priya Dwivedi was "Y u took 0.1 in the above calculation?"
Walter Roberson
Walter Roberson 2020 年 5 月 11 日
The link to learningtool does not go anywhere useful. I am not sure that we as outside people would be able to see a student solution anyhow.

サインインしてコメントする。

その他の回答 (3 件)

Gokul Krishnan
Gokul Krishnan 2020 年 9 月 8 日
編集済み: Walter Roberson 2020 年 9 月 8 日

1 投票

y=0.1/9.58;
hundred=y*3600
x=42.195/((121*60)+39);
marathon=x*3600
Abhiram K Narayanan
Abhiram K Narayanan 2020 年 11 月 20 日

0 投票

us_dist = 0.1
us_time = (9.58/3600)
hundred = us_dist/us_time
ken_dis = 42.195
ken_time = 2.0275
marathon = ken_dis/ken_time
Haya Aldawsari
Haya Aldawsari 2021 年 5 月 23 日

0 投票

%Usain
time1 = (9.58/60)/60
distance1 = 100/1000
hundred = distance1/time1
%Kenyan
time2 = 2 + (1/60) + (39/3600)
distance2 = 42.195
marathon = distance2 / time2

6 件のコメント

Rik
Rik 2021 年 5 月 24 日
This isn't Cody. Why did you post this answer? What does it teach? Why should it not be deleted?
Haya Aldawsari
Haya Aldawsari 2021 年 5 月 24 日
can you please explain what's wrong with my answer?
Rik
Rik 2021 年 5 月 24 日
Let me answer with a question: What is the fundamental difference between this answer and the previous one? If people read one of the answers and then the other, will they have learned more?
Haya Aldawsari
Haya Aldawsari 2021 年 5 月 24 日
I started learning Matlab one week ago by taking a course on Coursera and I had this question as an assignment, after solving this assignment, I posted my answer here which is really similar to other answers.
I see many similar answers here and still are not deleted, why?
I am new here and this is my first answer and I earned the First Answer badge from Matlab, I was happy when I received this encouraging email :)), and then you are telling me to delete my answer!
Do not kill the enjoyment, please!!!!
Rik
Rik 2021 年 5 月 25 日
Posting duplicate solutions is perfectly common for Cody, but here the goal should (in my view) be to have different solutions.
I absolutely don't want to kill your enjoyment. Maybe you are the next Walter Roberson. I just want every answer to actually add something. Why encourage cheating? I'm just one person, so it is not feasible for me to spend all my time deleting duplicate answers. I do delete a lot of them, but answering new questions is much more fun.
I hope you will join 'us' in answering non-homework questions. It is a lot of fun and you can learn a lot. Some people have been programming Matlab since around the time I was born and reading their solutions is quite an education.
Given this discussion I don't think this answer should be deleted anymore, but not due to the answer itself. I hope you understand my intentions.
Haya Aldawsari
Haya Aldawsari 2021 年 5 月 29 日
Thank you so much for your advice
Now I understand your point and you are right
I will definitely try my best to answer non-homework questions and learn from others' answers.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by