Help with splitting data point pairs
14 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
GGT
on 28 Apr 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 Comments
More Answers (1)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!