Question

Write a program that calculates the time Alonso took between two given laps during his race at the 2018 United States Grand P

plz explain using matlab

0 0
Add a comment Improve this question Transcribed image text
Answer #1

here I have converted each lap to there corresponding time

example

for 1st lap 0 to 1

t(1) is their corresponding time

and addition of times between that lap has been done

example for the time between 14 to 18 lap

will time for 15,16,17 and 18th lap

%program
clc
clear all
a=input('enter the initial lap : ');
b=input('enter the final lap:');
dis_one=3.426; %dis_one = distance in miles for one lap
n=b-a; %number of laps
d=dis_one*n; %distance covered in total
%loop for velocity matrix and corresponding time (seconds) matrix for each lap
for i=1:56
if i<=12
v(i)=215;
t(i)=dis_one*3600/v(i);
elseif i<=29
v(i)=197;
t(i)=dis_one*3600/v(i);
elseif i<=43
v(i)=164;
t(i)=dis_one*3600/v(i);
else
v(i)=208;
t(i)=dis_one*3600/v(i);
end
end
if a-b==0
total_time=t(a);
end
for i=a+1:b
total_time(i)=t(i);
end
time=sum(total_time)

Editor - CAMATLABTwork cheegg1.m Tools Debug Desktop Window Help File Edit Text Cel Stack Base Af. 1 *program lear all 3 - a-MATLAB File Edit Debug Desktop Window Help c MATLABTwork Ourrent Directory How to Add Whats New Shortcuts Workspace Command

Add a comment
Know the answer?
Add Answer to:
plz explain using matlab Write a program that calculates the time Alonso took between two given...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT