An experiment will be carried out repeatedly to determine the velocity of a part
ID: 3789223 • Letter: A
Question
An experiment will be carried out repeatedly to determine the velocity of a particle. The velocity is found to have one of three values, depending on the time (seconds) since the beginning the Leibniz series converges of the experiment. For time 0 lessthanorequalto t lessthanorequalto 1, velocity = 1.4 t For time 1.0 t lessthanorequalto 10.0 velocity = 14 + 5 cos(pi/10 (t - 10) For time t. 10.0, velocity = 11 - 9/5 (t - 25) Write an m-file which asks the user to enter a time and which will return the value of the velocity. Use conditional statements or the if ...end statements. Test at the command line for each of the following inputs of separately 0.5, 2.56, and 15 seconds. b.) Modify the above mile using a for loop to plot the above results over the interval 0 lessthanorequalto t lessthanorequalto 15. Properly label the plot.Explanation / Answer
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
int time;
float pi,velocity;
pi=3.14;
printf("enter the time");
scanf("%d",&time);
if(time>=0&&time<=1)
{velocity=1.4*t;
printf("%f",velocity);
}
else
{if(time>1 && time>=10)
{velocity=14+5cos(pi/10(time-10);
printf("%f",velocity);
}
}
else
{if(t>10)
velocity=11-9/5(time-25);
printf("%f",velocity);
}
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.