MATLAB: Oblique throw for golf ball

if statementphysics

I had the task of writing a program that will calculate the following for the golf ball:
1.Calculated and printed the angles and initial velocities at which the ball falls on the field.
2.Calculated and printed the angles and initial velocities at which the ball falls into the hole (hole in one). Printed travel time of the ball and plot the path of the balls.
3.Calculated the maximum height and maximum range of the ball for given data.
Given data:
The distance between the ball and the hole is 100m.
The size of the field is a circle 5m in diameter and the hole is in the middle.
Ф =[15:60] (angle) and Vo =[15:60] initial velocity
I have already written the code for the first part of the task but it stops for me in the second part wher ball fall direct in hole. I try use elseif D == 100 but more than obvious I didn’t tackle it the right way.
clear allclose allclc%1v0 = [15:60]; %initial speeda = [15:60];  %angleg = 9.81;     %gravitational accelerationl = 100;      %distance from ball to holefprintf('the ball falls on the field in the following cases:\n');for i = 1:length(v0)    for j = 1:length(a)        D = (v0(i)^2*sind(2*a(j)))/g;        if D>=97.5 && D<=102.5            fprintf('Vo = %.2f m/s | angle = %.2f° | D = %.2f  \n',v0(i),a(j), D);        elseif D==l %here is my problem :(            fprintf('HOLE IN ONE! Vo = %.2f m/s | angle = %.2f° | D = %.2f  \n',v0(i),a(j), D);        end    endend

v0 = [15:60]; %initial speeda = [15:60];  %angleg = 9.81;     %gravitational accelerationl = 100;      %distance from ball to holefprintf('the ball falls on the field in the following cases:\n');for i = 1:length(v0)    for j = 1:length(a)        D = (v0(i)^2*sind(2*a(j)))/g;        if D>=97.5 && D<=102.5            fprintf('Vo = %.2f m/s | angle = %.2f° | D = %.2f  \n',v0(i),a(j), D);        end   %Need new if because 100 falls between 97.5 and 102.5        if abs(D-l)<0.5 % Never test for exact equality with floating point numbers            fprintf('HOLE IN ONE! Vo = %.2f m/s | angle = %.2f° | D = %.2f  \n',v0(i),a(j), D);        end    endend