Help with splitting data point pairs
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
GGT
le 28 Avr 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 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!