Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1: The position of a projectile at any time t, fired with a speed of vo-162m/s at an angle -700, is given by: x(t)
Problem 1: The position of a projectile at any time t, fired with a speed of vo-162m/s at an angle -700, is given by: x(t) = vot cos a, y(t) = vot sin --gt2 where g 9.81 m/s2 write a C code that writes in a file the coordinates x(t),y(t) of the projectile, in increments of t 0.01s when the projectile is fired at t 0, its coordinates are x(0) = 0 and y(0) 0, when the projectile falls back to the ground, its coordinates will be again zero. Since you do not know how much time it will take for the projectile to return to the ground, you need to allow for a sufficiently long duration, of the order of 30s to 40s. You code should stop writing coordinates to the file when the projectile reaches the ground (negative y(t) should not be allowed). In order to write the values to a file, your code should declare a file variable, should "open" the file, should "write" to the file, and should "close" the file at the end of the code. To declare a file (myresults is a pointer to a file): FILE myresults; To open a file for writing (the filename is results.dat): myresults-fopen ("results.dat","w") To close the file: felose (myresults) To write to the file (e.g., the value of the real variable a): fprintf (myresults,"n", a) You should turn in your code and the plot of the projectile's path generated from the data you wrote to the results.dat file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started