Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to modify this to create two versions of this program, one that uses the Euler-Cromer method and the other the midpoint method. I

I need to modify this to create two versions of this program, one that uses the Euler-Cromer method and the other the midpoint method. I not really sure how these variables are defined, especially v. Then I need to find the largest value of tau, with no air resistance, that gives a 1% error in the horizontal range (with y1=0, v1=50 m/s and theta =45 degrees) image text in transcribed
using the Euler method. clear; help ball % Clear memory and print header %* Set initial position and velocity of the baseball y nput ("Enter initial height (meters): "); r1 = [0, y1); speed= input( 'Enter initial speed (m/s): '); theta.= input('Enter initial angle (degrees) .); v1# [speeds cos(theta*pi/188), % Initial vector position Initial velocity speedesin(theta*p1/180)]; r = r1; v = v1; % set initial position and velocity Set physical parameters (mass, Cd, etc.) Cd 0.35; area 4.3e-3; % Cross-sectional area of projectile ( 2) grav 9.81; * Gravitational acceleration (m/s^2) mass-= 0.145 ; Mas s of projectile (kg) airFlag input Air resistance? (Yes: 1, No:0):) if( airFLag 0 ) % Drag coefficient (dimensionless) % No air resistance rho = 0; else rho 1.2; % Density of air (kg/m^3) end air-const-0.5*Cd*rho*a rea/mas s; % Air resistance constant * Loop until ball hits ground or max steps completed tau npu t ('Enter tine step, tau (sec): .); % (sec) maxstep. 1000 ; % Maximum number of steps for istep 1:maxste Record position (conputed and theoretical) for plotting xplot (step) = r(1); % Record trajectory for plot yplot (1step) = r(2); t = ( ist ep.1)sta u ; Current Itine * calculate the acceleration of the ball accel.. air-cons t *norm(v)*v; % Air resistance accel (2) accel (2)-grav % Gravity calculate the new position and velocity using Euler method v = v + tau*accel; % Euler step (y

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

Step: 3

blur-text-image

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

i. What was the outcome of the interaction?

Answered: 1 week ago

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago