Possible Inconsistency and Variable Naming in Exercise 8.13 (Page 269)

Open Beginner friendly
#234 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
67/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Domain
documentation

Research direction

Locate the code for Exercise 8.13 on page 269 in the book’s supplementary materials. Review the scatter plot variable names and the label placement for unit 43, then compare them with the later fitlm exclusion step. Done means the naming is clear and the plotted label is readable; the issue does not identify a specific file or test.

Written by the indexing model from the issue text.

Description

Suggestion for the next edition

Dear Professors,

While testing Exercise 8.13 on page 269, I noticed a small detail regarding variable naming and coordinate positioning in the 3D scatter plot snippet.

Image

In the code snippet for Exercise 8.13:

sel = [9 30 31 38 47 21];
scatter3(X(sel,1), X(sel,2), y(sel), 'r', 'MarkerFaceColor', 'r')
sel1 = 43;
scatter3(X(sel1,1), X(sel1,2), y(sel1), 'k', 'MarkerFaceColor', 'k')
text(X(sel1,1), X(sel1,2), y(sel1), '43')

Using sel for the six outliers and sel1 for unit 43 creates a slight naming collision/confusion when moving to the fitlm model refitting step further down page 269, where sel is reused to specify the excluded units:

sel = [9 30 31 38 47 21];
out = fitlm(X, y, 'Exclude', sel)

Additionally, calling text() with the exact coordinates of unit 43 renders the label '43' directly over the black marker point, making it hard to read depending on the 3D rotation angle.

Also, maybe I suggest adding a small spatial offset to the text command can improve the readability ex:
text(X(sel1,1) + 0.1, X(sel1,2), y(sel1), '43')

Thanks again for your time!

Dominant language
MATLAB
Stars
30
Forks
1
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from UniprJRC/DSwithMATLAB

All issues in UniprJRC/DSwithMATLAB

Similar issues

More MATLAB issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.