Please help! I just started learning how to use Matlab and have no prior program
ID: 3789685 • Letter: P
Question
Please help! I just started learning how to use Matlab and have no prior programming knowledge.
Develop a computer program algorithm in Matlab to solve the problem.
Use bisection to determine the drag coefficient needed so that an 82-kg parachutist has a velocity of 36 m/s after 4 s of free fall. Note: The acceleration of gravity is 9.81 m/s^2. Start with initial guesses of xl = 3 and xu = 5 and iterate until the approximate relative error fallas below 2%. Also perform an error check by substituting your final answer into the original equation.
-( )t) f (c) = g *mz l-e- )tExplanation / Answer
The matlab program using Bisection method to determin drag coefficient
m = 82; % weight of parachutist
v = 36; % the velocity
t = 4; %time
g = 9.8; %gravity
xl = 3;xu =5;%initial guesses
toler = 2; % Tolerence
iter = 0; % iteration counter initially zero
Max_iter = 100; % Maximum number of iteration
f = @(c) (g*m/c)*(1-exp(-1*(c/m)*t))-v; % function given
u = f(xl); % the function value at xl
v = f(xu);% the function value at xs
c=(xl+xu)*0.5; % mid point of xl and xs
err=abs(xu-xl)*0.5*100; % error
if (u*v<=0) % proced only if u nad v are of oposit sign
while (err>toler)&&(iter<=Max_iter) % loop
w=f(c); % function value ate the middle
if (w*u<0) % checking the sign of the new functional value
xu=c;v=w; % if w and u are oposite sign replace xu with c
end
if (w*u>0)% if w and u are same sign replace xl with c
xl=c;u=w;
end
iter=iter+1; % increment iteration count
c=(xl+xu)*0.5;% mid point of xl and xs
err=abs(xu-xl)*0.5*100;% error
end
if (iter>Max_iter) % mathod faild if iteration reach Max_iter
disp('Method failed to converge')
else % else method converges and print the result
fprintf(' The drag coefficient = %f ',c);
fprintf('f(%f) = %f ',c,f(c));
end
else% display error if f(xl) and f(xu) are same sign
disp('The method cannot be applied f(xl)f(xu)>0')
end
OUTPUT
The drag coefficient = 3.546875
f(3.546875) = -0.003756