[r,p]=corrcoef(x,y) %The output I recieved was r = 1.0000 0.6612 0.6612 1.0000 p = 1.0000 0.0000 0.0000 1.0000 |
scatterplot(hw4data(:,1;:,2)) |
and niether of those worked. What syntax am i forgetting here?
Q6: F
Q7: F
Q8: I
Q9: E
Q10: I
Q11: W
Q12: I
Q13: H
A1: The data each column represents is explained in the homework assignment, page 3, section 2.2 - please read the entire assignment document carefully before going on. Each step is explained.
A2:You can create the table in Word or excel (you aren't expected to create it in Matlab). If you create the table in excel, please paste it into your Word (or other program) homework document.
A3: So it sounds like you're halfway there. Basically you have the actual y-values right? Now you have an equation which computes a y-value given a certain x-value. So plug into that equation the x-data we have, compute a 'predicted' set of y-values, then subtract those from the actual y-data. That vector (we'll call it 'Error' or 'E') is what you compute the norm of (using the command 'norm(E)' in matlab). You'll get a number which represents a criterion for how closely the fit approximates the data. Then you do this for each fit method, and you can compare those numbers. TA-DA!!!!
A4: The zeros are not actually zero - type p(2,1) and you'll see that it's actually a really small number, not zero, so it's just VERY significant. The correlation coefficient should come out the same as with r=corrcoef(x,y), we're just adding the p calculation. So if p is close to zero in an off-diagonal term, that means it's very low probability that you would get that correlation by chance, and that the correlation result is significant.
h = hw4data(:,1) w = hw4data(:,2) plot(h,w,'*') |
you use the plot command for this one, and format the linetype to be '*'