Help with splitting data point pairs
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
BaconSwordfish
el 28 de Abr. de 2015
Comentada: BaconSwordfish
el 30 de Abr. de 2015
So I was tasked with defining my x and y with x= rcos(theta) and y=rsin(theta). Both r and theta are data arrays. My next step is to do the following: Utilize conditional statement(s) in order to split data point pairs into separate arrays depending on which quadrant they would fall into if plotted “y versus x”
I am unsure exactly what this is asking me to do and unsure how to go about it. Thank you!
0 comentarios
Respuesta aceptada
GGT
el 28 de Abr. de 2015
BaconSwordfish. After many hours I finally got it. You need two new counters in a for loop with an if end statement like so assuming you already have x and y saved into arrays.
for l=1:length(x)
if x(l)>0
xQ14=x(x>0); %x is positive in quadrants 1 & 4
end
if x(l)<0
xQ23=x(x<0);
end
end
2 comentarios
GGT
el 28 de Abr. de 2015
By the way that is l as in lima in the parentheses; looks like the number one.
Más respuestas (1)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!