Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB Projectile Motion Problem : Plot Trajectory of Projectile from launch to max height in MATLAB (restricted domain/range plots based off max height and t_end)

MATLAB Projectile Motion Problem : Plot Trajectory of Projectile from launch to max height in MATLAB (restricted domain/range plots based off max height and t_end)

PLEASE HELP WILL RATE GREAT!! I am new to coding and this wasn't explained by substitute teacher! show all code able to copy and paste please! It is DUE in a COUPLE OF HOURS! Thanks so much!

Revise code so that t_end is general --- i.e. calculated from theory Hardcode all inputs (like Launch angle (q), Initial velocity (V0), Initial Position (y0) no need to prove you can do user input here Make Certain that comments are best ever and that appropriate use of sections is included Plot the trajectory of the projectile Use subplot to make plots of (y vs. x), (y vs. t) and (x vs. t) Use sprintf (or other) to add key values in to title Use appropriate titles for plots and axes Publish your output in PDF format

THIS IS MY CODE SO FAR BUT IT DOES PLOT ANYTHING in the figures.

clc; clear all workspace; format compact; format long g; %This is where user may input Initial Velocity (m/s), and Initial Height (m)%

%Hardcoded in%

y0 = 0;

V0 = 45;

%This is where user may input Launch Angle in Degrees%

%Hard coded in%

angledegree = 45;

anglerad = (angledegree*pi)/180;

ymax = (V0^2*(sin(anglerad))^2)/19.62;

%t_end should be auto calcuated based off of max height and then doesnt plot or for loop any further of the trajectory.%

t_end = (2*V0*sin(anglerad))/9.81;

g = -9.81; t = 0:.1:t_end ; Ay= g; numberOfAngles = length(anglerad); time=length(t_end); for i = 1 : time thistime = t(i); xVelocity = V0 * cos(anglerad); yVelocity = V0 * sin(anglerad); x = xVelocity .* thistime ; y = yVelocity .* thistime + (1/2) * Ay .* thistime.^2 + y0; subplot(2,2,1); plot(x,y); caption = sprintf('Angle = %.3f radians = %.2f degrees ', ... angledegree, anglerad*180/pi); title('y(t) vs. x(t)'); xlabel('distance (meters)'); ylabel('height (meters)'); grid on; ylim([0 ymax]) xlim([0 t_end]) subplot(2,2,2); plot(t_end,y); caption = sprintf('Angle = %.3f radians = %.2f degrees ', ... angledegree, anglerad*180/pi); title('time vs. y(t)'); ylabel('height (meters)'); xlabel('time (seconds)'); grid on; ylim([0 ymax]) xlim([0 t_end]) subplot(2,2,3); plot(t_end,x); caption = sprintf('Angle = %.3f radians = %.2f degrees ', ... angledegree, anglerad*180/pi); title('time vs. x(t)'); ylabel('distance (meters)'); xlabel('time (seconds)'); grid on; xlim([0 t_end]) end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe how to train managers to coach employees. page 404

Answered: 1 week ago

Question

Discuss the steps in the development planning process. page 381

Answered: 1 week ago