# Writing a script that tells you the quadrant of the coordinates

14 visualizaciones (últimos 30 días)
Seth el 26 de Oct. de 2014
Respondida: Rashmil Dahanayake el 26 de Oct. de 2014
I am not sure how to go about this question. Any help will be greatly appreciated. Write a function quadrant that receives two arguments, which are a pair of (X, Y) coordinates, and returns the corresponding quadrant in roman numerals (i.e. I-IV), for example,>> fprintf('Input coordinates will be in quadrant %s.\n',quadrant(3,4)) Input coordinates will be in quadrant I.
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Roger Stafford el 26 de Oct. de 2014
Hint: See if you can convert the logicals x>=0 and y>=0 into numbers from one to four in accordance with the quadrant. Is really is easy to do.

Iniciar sesión para comentar.

Rashmil Dahanayake el 26 de Oct. de 2014
x=4;y=-7; %test value
switch true
case x >=0 && y>0
case x <=0 && y>0
case x <=0 && y<0
case x >=0 && y<0
otherwise
disp('Origin')
end
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre NaNs en Help Center y File Exchange.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by