10.11 Aptitude Score Number of Sales 18 54 26 64 28 54 34 62 36 68 42 70 48 76 5
ID: 641179 • Letter: 1
Question
10.11
Aptitude Score
Number of Sales
18
54
26
64
28
54
34
62
36
68
42
70
48
76
52
66
54
76
60
74
Problem 10.11. Generate a Matlab scipt to load a data file called WHO_hiring_data.txt. Generate a Matlab script to a) plot the data, labeling the x axis as Aptitude Score, the y axis label as Number of Sales and the title as WHO Sales Performance. Determine the slope and intercept of the linear least squares equation of the line. Draw the line on the curve. Calculate the coefficient of correlation.
Output the equation in the form
Number of Sales = (calculated slope) * Aptitude Score + (calculated intercept)
Aptitude Score
Number of Sales
18
54
26
64
28
54
34
62
36
68
42
70
48
76
52
66
54
76
60
74
Explanation / Answer
Hi
Feel free to ask if any queries and kindly rate :) .
It takes a lot of effort.
The code is in the zip file.
The link is this.
http://s000.tinyupload.com/index.php?file_id=96097724888818890189
Anyway, the script is
filename = 'WHO_hiring_data.txt';
delimiterIn = ' ';
headerlinesIn = 1;
A = importdata(filename,delimiterIn,headerlinesIn);
apti_score = A.data(:,1);
number_sale = A.data(:,2);
plot(apti_score,number_sale);
coeffs = polyfit(apti_score, number_sale,1);
intercept = coeff(2);
slope = coeff(1);
hold on;
plot(apti_score, number_sale, 'b*-', 'LineWidth', 2, 'MarkerSize', 15);
xlabel('Aptitude Score');
ylabel('Number of Sales');
title('WHO Sales Performance');
% Get fitted values
fittedX = linspace(min(apti_score), max(number_sale), 200);
fittedY = polyval(coeffs, fittedX);
hold on;
plot(fittedX, fittedY, 'r-', 'LineWidth', 3);
disp(['Number of Sales = ', num2str(slope) , ' * Aptitude Score + ' , num2str(intercept)]);
And the content of txt file is
Aptitude_Score Number_of_Sales
18 54
26 64
28 54
34 62
36 68
42 70
48 76
52 66
54 76
60 74
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.