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

Generate a matlab program that takes a text file of random (x,y) coordinates and

ID: 657155 • Letter: G

Question

Generate a matlab program that takes a text file of random (x,y) coordinates and shows the total number of points in each quadrant. Quadrant classifications are shown in Table 1. No points will have coordinate values of 0. All coordinates will be integers between -128 and +128.


Table 1: Quadrant classifications.

If x is . . .

and y is . . .

then quadrant is . . .

x>0

y>0

1

x<0

y>0

2

x<0

y<0

3

x>0

y<0

4

If x is . . .

and y is . . .

then quadrant is . . .

x>0

y>0

1

x<0

y>0

2

x<0

y<0

3

x>0

y<0

4

Explanation / Answer

zmin=min(Z); zmax=max(Z); map=colormap; color_steps=size(map,1); hold on for i=1:color_steps ind=find(Z=zmin+(i-1)*(zmax-zmin)/color_steps); plot(X(ind),Y(ind),'o','Color',map(i,:)); end