Se está descargando tu SlideShare. ×

# In MATLAB-Write a program For the next two weeks- the time that you sp.docx

Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio Cargando en…3
×

1 de 1 Anuncio

# In MATLAB-Write a program For the next two weeks- the time that you sp.docx

In MATLAB,Write a program
For the next two weeks, the time that you spend in the library increases by 10 mins each day, starting with 20 mins on the first day. For each hour, or fraction thereof, that you are in the library, you spend \$.175 on coffee. How much money are you going to spend on coffee in the library during the second of the next two weeks?
Solution
start_time=20;
coffee_rate_hour=0.175;
total_time=0;
old_time=start_time;
for i=1:14 % 14 days = 2 weeks
new_time=old_time+(i-1)*10;% i-1 because first day time is 20
total_time=total_time+new_time;
end
time_in_hours=total_time/60;
expenditure=time_in_hours*coffee_rate_hour
.

In MATLAB,Write a program
For the next two weeks, the time that you spend in the library increases by 10 mins each day, starting with 20 mins on the first day. For each hour, or fraction thereof, that you are in the library, you spend \$.175 on coffee. How much money are you going to spend on coffee in the library during the second of the next two weeks?
Solution
start_time=20;
coffee_rate_hour=0.175;
total_time=0;
old_time=start_time;
for i=1:14 % 14 days = 2 weeks
new_time=old_time+(i-1)*10;% i-1 because first day time is 20
total_time=total_time+new_time;
end
time_in_hours=total_time/60;
expenditure=time_in_hours*coffee_rate_hour
.

Anuncio
Anuncio

### In MATLAB-Write a program For the next two weeks- the time that you sp.docx

1. 1. In MATLAB,Write a program For the next two weeks, the time that you spend in the library increases by 10 mins each day, starting with 20 mins on the first day. For each hour, or fraction thereof, that you are in the library, you spend \$.175 on coffee. How much money are you going to spend on coffee in the library during the second of the next two weeks? Solution start_time=20; coffee_rate_hour=0.175; total_time=0; old_time=start_time; for i=1:14 % 14 days = 2 weeks new_time=old_time+(i-1)*10;% i-1 because first day time is 20 total_time=total_time+new_time; end time_in_hours=total_time/60; expenditure=time_in_hours*coffee_rate_hour