Question: function [ x , y ] = projectilePosition ( v _ o , theta _ 0 , t ) % Constants g = 9 .

function [x, y]= projectilePosition(v_o, theta_0, t)% Constants g =9.81; % gravity constant (m/s^2)% Calculate x and y coordinates x = v_o * cosd(theta_0)* t; y = v_o * sind(theta_0)* t -(1/2)* g * t^2; end % Define function to print results function printResults(x, y) fprintf('Projectile Position:
'); fprintf('x =%.2f meters
', x); fprintf('y =%.2f meters
', y); end % Initialize variables v_o =20; % initial velocity (m/s) theta_0=45; % angle of departure (degrees) t =2; % time (s)% Calculate projectile position [x, y]= projectilePosition(v_o, theta_0, t); % Print results printResults(x, y);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!