Question
For MATLAB
3. write a program to plot a scatter plot of data (x, y) pairs and compute the correlation coefficient. Data and details are
0 0
Add a comment Improve this question Transcribed image text
Answer #1


close all
clear
clc

x = [161 203 235 176 201 188 228 211 191 178];
y = [159 206 241 163 197 193 209 189 169 201];


scatter(x,y)
xlabel('x')
ylabel('y')
title('scatter plot')
grid on

Xbar = mean(x);
Ybar = mean(y);

Sxx = sum((x-Xbar).^2)
Syy = sum((y-Ybar).^2)
Sxy = sum((x-Xbar).*(y-Ybar))

r = Sxy/sqrt(Sxx*Sxy)

fprintf('Yes, the scatter plot and the correlation coefficient agree')
fprintf(' ')

scatter plot 250 240 230 220 210 200 190 180 170 160 150 160 170 180 190 200 210 220 230 240

COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER
PLEASE PLEASE GIVE A THUMBS UP

Add a comment
Know the answer?
Add Answer to:
For MATLAB 3. write a program to plot a scatter plot of data (x, y) pairs...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT