Question

In: Computer Science

MATLAB Write a code that takes the initial velocity and angle as an input and outputs...

MATLAB

Write a code that takes the initial velocity and angle as an input and outputs the maximum height of the projectile and its air time.

Follow the pseudo code below. This will not be provided in as much detail in the future so you’ll have to provide pseudocode or a flowchart to showcase your logic. For this first assignment though, the logic is laid out below with some indented more detailed instructions.

PROGRAM Trajectory:
Establish the User Interface (Typically referred to as the UI);

INPUT INPUT

Solve
Solve
Print

Start with an explanation of activity

Ask the user for the initial velocity;

Ask the user for the initial angle;

Include descriptive requests for inputs so the user knows what information is required.

for the maximum height the ball reaches;

for the length of time the ball is in the air;

the answers for the user;

Include a description with that return so the user understands what the data is

Plot height versus time; Plot height versus distance;

Do not overwrite your previous figure! This is a new plot but you still want the old one.

Make it clear what the plots are. Label the plot axes with units, include a title, and use a marker for the plot points.

END

Solutions

Expert Solution

program:

velocity = input("Please enter user initial velocity: ");
angle = input("Please enter initial angle in degrees: ");
angle = angle*pi/180;
%convert angle in degree to radian
gravity = 9.80;
max_height = velocity^2 * sin(angle)^2 / (2*gravity);
%formula to find max_height
time_of_flight = 2*velocity*sin(angle)/gravity;
%formula to find lenght time
fprintf("maximum height the ball reaches: %d\n",max_height);
fprintf("length of time the ball is in the air: %d\n",time_of_flight);
t = 0:time_of_flight;
height = velocity.* t.*sin(angle)./4;
dist = velocity.*t;
g = f.*sin(10*t);

subplot(3,1,1);
plot(t,height);
xlabel('time');
ylabel('height');
title('time vs height');

subplot(3,1,3);
plot(dist,height);
xlabel('distance');
ylabel('height');
title('distance vs height');

Output:


Related Solutions

Write a code that takes the initial velocity and angle as an input and outputs the...
Write a code that takes the initial velocity and angle as an input and outputs the maximum height of the projectile and its air time. Follow the pseudo code below. This will not be provided in as much detail in the future so you’ll have to provide pseudocode or a flowchart to showcase your logic. For this first assignment though, the logic is laid out below with some indented more detailed instructions. PROGRAM Trajectory: Establish the User Interface (Typically referred...
write a matlab code to find the following: initial position, initial velocity, and acceleration using the...
write a matlab code to find the following: initial position, initial velocity, and acceleration using the algorithm and information below time(seconds). height(m) velocity(m/s) 0. 0.2. 2.95 algorithm: 1. Enter data in to arrays. 2. Fit the height data to a 2nd order polynomial. 3. Evaluate the polynomial at enough points to get a smooth curve. 4. Find the velocity model by taking derivative of the height polynomial. 5. Evaluate the velocity polynomial at enough times to get a smooth curve
Write a program that takes a date as input and outputs the date's season. The input...
Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. Ex: If the input is: April 11 the output is: Spring In addition, check if the string and int are valid (an actual month and day). Ex: If the input is: Blue 65 the output is: Invalid The dates for each season are: Spring: March 20 - June 20 Summer:...
Write a program that takes in a positive integer as input, and outputs a string of...
Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. Ex: If the input is: 6 the output is: 011 6 in binary is...
IN PYTHON Write a program that takes in a positive integer as input, and outputs a...
IN PYTHON Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x // 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string....
Write a program that takes in a line of text as input, and outputs that line...
Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH yeH IN C++ PLEASE!
Write a program that takes in a positive integer as input, and outputs a string of...
Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. The code needs to be in Java
C++ Write a program that takes a string and integer as input, and outputs a sentence...
C++ Write a program that takes a string and integer as input, and outputs a sentence using those items as below. The program repeats until the input string is "quit". If the input is: apples 5 shoes 2 quit 0 the output is: Eating 5 apples a day keeps your doctor away. Eating 2 shoes a day keeps your doctor away.
Write a program in python that takes a date as input and outputs the date's season....
Write a program in python that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. Ex: If the input is: April 11 the output is: Spring In addition, check if the string and int are valid (an actual month and day). Ex: If the input is: Blue 65 the output is: Invalid The dates for each season are: Spring: March 20 - June...
Write a program that takes a string input from the user and then outputs the first...
Write a program that takes a string input from the user and then outputs the first character, then the first two, then the first three, etc until it prints the entire word. After going up to the full word, go back down to a single letter. LastNameUpDown. Input: Kean Output: K Ke Kea Kean Kea Ke K
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT