Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a question for MATLAB. Thanks for any help in advance! The handicap diff

ID: 3715340 • Letter: T

Question

This is a question for MATLAB. Thanks for any help in advance!

The handicap differential (HCD) for a round of golf is calculated from the formula: 113 (Score Course Rating) Course Slope HCD = The course rating and the slope are measures of how difficult a particular course is. A golfer's handicap is calculated from a certain number N of their best (lowest) handicap scores according to the following table # Rounds plaved 15-16 # Rounds played N N 7-8 9-10 11-12 13-14 For example, if 13 rounds have been played, only the best five handicaps are used. A handicap cannot be computed for fewer than five rounds. If more than 20 rounds have been played, only the 20 most recent results are used. Once the lowest N handicap differentials have been identified, they are averaged and then rounded down to the nearest tenth. The result is the player's handicap. Write a program in a script file that calculates a person's handicap The program asks rating, the second is the course slope, and the third is the players score. Each row corresponds to one round. Th the user to enter the golfers record in a three columns matrix where the first column is the course program for players with the f ollowing records. e program displays the person's handicap. Execute the pr Ratin Slo Score 122 87 83 72.8 69.7 70.3 70.9 72.3 71.6 70.3 72.8 70.9 73.1 68.2 74.2 71.9 103 115 116 79 122 115 89 83 80 94 109 132 115 135 121 103 84 Ratin 72.2 71.6 74.0 68.2 70.2 69.6 66.6 Score 73 69 0 119 122 139 125 74 130 109 Hand in your MATLAB program and output.

Explanation / Answer

The HCD formula is given as:

HCD = 113(score - course rating) / course slope

MATLAB CODE:

rounds=input('Enter No of rounds');
for i=1:rounds
Crating(i)=input('Enter Course Rating:');
Cslope(i)=input('Enter Course Slope:');
Cscore(i)=input('Enter Course Score:');
end
if(rounds==5||rounds==6)
N=1
elseif(rounds==7||rounds==8)
N=2
elseif(rounds==9||rounds==10)
N=3
elseif(rounds==11||rounds==12)
N=4
elseif(rounds==13||rounds==14)
N=5
elseif(rounds==15||rounds==16)
N=6
elseif(rounds==17)
N=7
elseif(rounds==18)
N=8
elseif(rounds==19)
N=9
elseif(rounds==20)
N=10
end
sumRating=0;
sumSlope=0;
sumScore=0;
for i=1:rounds
sumRating=sumRating+Crating(i);
sumSlope=sumSlope+Cslope(i);
sumScore=sumScore+Cscore(i);
end
avgRating=(((sumRating/rounds)+5)*10)/10;
avgSlope=(((sumSlope/rounds)+5)*10)/10;
avgScore=(((sumScore/rounds)+5)*10)/10;
HDC=((avgScore-avgRating)/avgSlope)*113

OUTPUT:

a)

Enter No of rounds14
Enter Course Rating71.6
Enter Course Slope122
Enter Course Score85
Enter Course Rating72.8
Enter Course Slope118
Enter Course Score87
Enter Course Rating69.7
Enter Course Slope103
Enter Course Score83
Enter Course Rating70.3
Enter Course Slope115
Enter Course Score81
Enter Course Rating70.9
Enter Course Slope116
Enter Course Score79
Enter Course Rating72.3
Enter Course Slope117
Enter Course Score91
Enter Course Rating71.6
Enter Course Slope122
Enter Course Score89
Enter Course Rating70.3
Enter Course Slope115
Enter Course Score83
Enter Course Rating72.8
Enter Course Slope118
Enter Course Score92
Enter Course Rating70.9
Enter Course Slope109
Enter Course Score80
Enter Course Rating73.1
Enter Course Slope132
Enter Course Score94
Enter Course Rating68.2
Enter Course Slope115
Enter Course Score78
Enter Course Rating74.2
Enter Course Slope135
Enter Course Score103
Enter Course Rating71.9
Enter Course Slope121
Enter Course Score84

N = 5

HDC = 13.6280

b)

Enter No of rounds7
Enter Course Rating:72.2
Enter Course Slope:119
Enter Course Score:71
Enter Course Rating:71.6
Enter Course Slope:122
Enter Course Score:73
Enter Course Rating:74.0
Enter Course Slope:139
Enter Course Score:78
Enter Course Rating:68.2
Enter Course Slope:125
Enter Course Score:69
Enter Course Rating:70.2
Enter Course Slope:130
Enter Course Score:74
Enter Course Rating:69.6
Enter Course Slope:109
Enter Course Score:69
Enter Course Rating:66.6
Enter Course Slope:111
Enter Course Score:74

N = 2


HDC = 1.9807

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote