Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB Coding you DONT need para to do the problem at hand but: function dvdt = para(v) g=9.81; m=68.1; c=12.5; dvdt = g-c/m*v; end function
MATLAB Coding
you DONT need para to do the problem at hand but:
function dvdt = para(v)
g=9.81;
m=68.1;
c=12.5;
dvdt = g-c/m*v;
end
function yf = Euler(yi,ti,tf,dt)
if ti > tf
disp('error')
else
t = ti;
y = yi;
while t
slope = para(y);
y = y + slope * dt;
t = t + dt
end
yf = y;
end
end
You will determine the velocity of the falling parachutist using the method described in class; in order to do that, you will code the two functions para and Euler as discussed in class. First, code para in exactly the same manner as the class version. Then, modify Euler to have the following syntax: [ TOUT , YOUT ] Euler ( problem, yi, ti , tf , dt ) = where all the input arguments (except the first one) are the same as those defined in class, TOUT is a vector containing the incremental time values from ti to tf and YOUT is the solution vector corresponding to the times in TOUT (i.e.: each element in YOUT is the computed Euler approximation at the corresponding element (time) in TOUT; the first element in TOUT is ti and the first element in YOUT is yi). The first input argument, problem, is called a function handle and will allow you to make Euler a completely generic function, (i.e. without any reference to the specific parachutist problem). problem is the generic name of the file that contains the slope that is needed by Euler. To use the function handle in Euler, simply replace the call to para (in the class version) by a call to problem. Instead of the while loop presented in class, use a for loop. Ifyou are having trouble with this, you can use a while loop, but with a 15-point penalty. In either case, make sure that the last element in TOUT is always tf, regardless of the values of ti, tf and dt (i.e. even in the case when (tf- ti) is not evenly divisible by dt) and make sure that the last value of YOUT is always the Euler approximation calculated at the correct tfStep 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