Help with splitting data point pairs

13 visualizaciones (últimos 30 días)
BaconSwordfish
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!

Respuesta aceptada

GGT
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
GGT el 28 de Abr. de 2015
By the way that is l as in lima in the parentheses; looks like the number one.
BaconSwordfish
BaconSwordfish el 30 de Abr. de 2015
After trying to use this there seems to be a slight problem. Although this does a great job splitting the data into their positive and negative terms, I need to create arrays of the four quadrants. However, I can not do this because not all of the arrays are of equal length. So I can not take the positive xQ14 and yQ12 and say this is quadrant 1. If that makes any sense.

Iniciar sesión para comentar.

Más respuestas (1)

the cyclist
the cyclist el 28 de Abr. de 2015
I think it is asking you about this type of quadrant.
  4 comentarios
BaconSwordfish
BaconSwordfish el 28 de Abr. de 2015
I'm supposed to find what quadrant each data pair falls in. I am not sure how to write a code to do this. x =
4.0000
0.5532
-3.8499
-1.6475
3.3788
2.6851
-2.5332
-3.5608
1.2613
4.0734
0.4154
-3.9223
-2.2869
2.7904
3.8334
-0.5779
-4.2308
-2.2213
2.7094
4.2620
0.6174
-3.7916
-3.9238
0.2480
4.1960
3.9210
-0.1772
-4.1438
-4.4289
-0.9147
3.3773
5.0458
2.9349
-1.2966
-4.6658
-5.0015
-2.2154
1.9058
4.9653
5.3493
2.9717
2.9717
-0.9569
-4.3751
-5.4175
-3.3918
0.6331
4.2419
5.0696
2.4382
-1.9148
-4.8094
-3.9307
0.1470
4.0681
4.3415
0.5874
-3.7022
-4.2302
-0.3277
3.8949
3.6832
-0.8347
-4.2979
-2.3444
2.6221
4.0430
-0.1022
-4.0637
-2.0992
2.9653
3.4812
-1.4082
-4.0333
-0.1496
3.9540
1.4848
-3.4611
-2.5314
2.7117
3.2949
-1.7923
-3.7906
0.7384
4.0078
0.4332
-3.8911
-1.6839
3.3407
2.9029
-2.2422
-3.8534
0.5497
4.1486
1.5631
-3.3331
-3.5251
1.1693
4.3351
1.8698
-2.9846
-4.2364
-0.4971
3.8440
4.0079
-0.0580
-4.1011
-4.1827
-0.3547
3.8220
4.7504
1.7829
-2.6070
-5.0684
-3.9076
-0.0607
3.8490
5.3771
3.7096
-0.0745
-3.8369
-5.6347
-5.6347
-4.4918
-1.0446
2.9490
5.2549
4.4342
0.8644
-3.2465
-5.1200
-3.3298
0.9327
4.4372
4.2972
0.4982
-3.7134
-4.4473
-0.8783
3.5429
4.2175
0.3012
-3.9180
-3.5139
1.1421
4.3223
1.8810
-3.0452
-3.7418
0.8513
4.1681
1.2650
-3.5350
-2.8114
2.3531
3.6949
-1.0102
-4.0157
-0.2771
3.9160
1.4198
-3.5059
-2.3938
-3.5059
1.4198
3.9160
-0.2771
-4.0157
-1.0102
3.6949
2.3531
-2.8114
-3.5350
1.2650
4.1681
0.8513
-3.7418
-3.0452
1.8810
4.3223
1.1421
-3.5139
-3.9180
0.3012
4.2175
3.5429
-0.8783
-4.4473
-3.7134
0.4982
4.2972
4.4372
0.9327
-3.3298
-5.1200
-3.2465
0.8644
4.4342
5.2549
2.9490
-1.0446
-4.4918
-5.6347
-5.6347
-3.8369
-0.0745
3.7096
5.3771
3.8490
-0.0607
-3.9076
-5.0684
-2.6070
1.7829
4.7504
3.8220
-0.3547
-4.1827
-4.1011
-0.0580
4.0079
3.8440
-0.4971
-4.2364
-2.9846
1.8698
4.3351
1.1693
-3.5251
-3.3331
1.5631
4.1486
0.5497
-3.8534
-2.2422
2.9029
3.3407
-1.6839
-3.8911
0.4332
4.0078
0.7384
-3.7906
-1.7923
3.2949
2.7117
-2.5314
-3.4611
1.4848
3.9540
-0.1496
-4.0333
-1.4082
3.4812
2.9653
-2.0992
-4.0637
-0.1022
4.0430
2.6221
-2.3444
-4.2979
-0.8347
3.6832
3.8949
-0.3277
-4.2302
-3.7022
0.5874
4.3415
4.0681
0.1470
-3.9307
-4.8094
-1.9148
2.4382
5.0696
4.2419
0.6331
-3.3918
-5.4175
-4.3751
-0.9569
2.9717
2.9717
5.3493
4.9653
1.9058
-2.2154
-5.0015
-4.6658
-1.2966
2.9349
5.0458
3.3773
-0.9147
-4.4289
-4.1438
-0.1772
3.9210
4.1960
0.2480
-3.9238
-3.7916
0.6174
4.2620
2.7094
-2.2213
-4.2308
-0.5779
3.8334
2.7904
-2.2869
-3.9223
0.4154
4.0734
1.2613
-3.5608
-2.5332
2.6851
3.3788
-1.6475
-3.8499
0.5532
y =
0
3.9628
1.1037
-3.6573
-2.1781
3.0067
3.1533
-1.9521
-3.8793
0.4664
4.1021
1.3510
-3.4943
-3.1470
1.8070
4.2327
0.8125
-3.7357
-3.4495
1.2024
4.4293
2.4564
-2.3332
-4.6074
-2.0381
2.6222
4.7675
2.4736
-2.0554
-4.8552
-3.6870
0.3871
4.1984
5.0208
2.4064
-1.7986
-4.9043
-5.1047
-2.4053
1.6108
4.8134
4.8134
5.5040
3.3613
-0.5835
-4.1780
-5.2772
-3.0930
1.0905
4.5050
4.6844
1.3672
-2.9932
-4.8804
-2.5962
1.9778
4.6803
2.8379
-1.8428
-4.5533
-2.2890
2.5366
4.3489
0.8765
-3.6597
-3.4183
1.3799
4.2367
1.0845
-3.6102
-2.9012
2.2094
3.8506
-0.6106
-4.0580
-0.8518
3.7477
2.0447
-3.1116
-2.9473
2.2702
3.5760
-1.2811
-3.9363
0.1659
3.9965
1.0533
-3.6775
-2.3087
2.8658
3.4326
-1.4667
-4.1119
-0.4788
3.9047
2.6174
-2.4132
-4.1464
-0.3120
3.9678
3.2714
-1.4327
-4.4903
-2.4624
2.2862
4.6644
2.3304
-2.2946
-4.8129
-3.0385
1.3578
4.6713
4.3375
0.7426
-3.4089
-5.2494
-3.6654
0.2169
3.9911
5.5167
4.0605
0.4999
0.4999
-3.3216
-5.4175
-4.5818
-1.1601
2.9305
5.1781
4.0435
0.1612
-3.8108
-4.9122
-2.1729
2.3182
4.8002
2.9951
-1.5720
-4.5813
-2.9560
1.7473
4.5077
2.1562
-2.6949
-4.2350
-0.4560
3.8758
2.9961
-1.9897
-4.1189
-0.2590
3.9509
2.1221
-2.9843
-3.3321
1.6845
3.9166
-0.3518
-4.0104
-0.8689
3.7449
1.9284
-3.2046
-1.9284
-3.7449
0.8689
4.0104
0.3518
-3.9166
-1.6845
3.3321
2.9843
-2.1221
-3.9509
0.2590
4.1189
1.9897
-2.9961
-3.8758
0.4560
4.2350
2.6949
-2.1562
-4.5077
-1.7473
2.9560
4.5813
1.5720
-2.9951
-4.8002
-2.3182
2.1729
4.9122
3.8108
-0.1612
-4.0435
-5.1781
-2.9305
1.1601
4.5818
5.4175
3.3216
-0.4999
-0.4999
-4.0605
-5.5167
-3.9911
-0.2169
3.6654
5.2494
3.4089
-0.7426
-4.3375
-4.6713
-1.3578
3.0385
4.8129
2.2946
-2.3304
-4.6644
-2.2862
2.4624
4.4903
1.4327
-3.2714
-3.9678
0.3120
4.1464
2.4132
-2.6174
-3.9047
0.4788
4.1119
1.4667
-3.4326
-2.8658
2.3087
3.6775
-1.0533
-3.9965
-0.1659
3.9363
1.2811
-3.5760
-2.2702
2.9473
3.1116
-2.0447
-3.7477
0.8518
4.0580
0.6106
-3.8506
-2.2094
2.9012
3.6102
-1.0845
-4.2367
-1.3799
3.4183
3.6597
-0.8765
-4.3489
-2.5366
2.2890
4.5533
1.8428
-2.8379
-4.6803
-1.9778
2.5962
4.8804
2.9932
-1.3672
-4.6844
-4.5050
-1.0905
3.0930
5.2772
4.1780
0.5835
-3.3613
-5.5040
-4.8134
-4.8134
-1.6108
2.4053
5.1047
4.9043
1.7986
-2.4064
-5.0208
-4.1984
-0.3871
3.6870
4.8552
2.0554
-2.4736
-4.7675
-2.6222
2.0381
4.6074
2.3332
-2.4564
-4.4293
-1.2024
3.4495
3.7357
-0.8125
-4.2327
-1.8070
3.1470
3.4943
-1.3510
-4.1021
-0.4664
3.8793
1.9521
-3.1533
-3.0067
2.1781
3.6573
-1.1037
-3.9628

Iniciar sesión para comentar.

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!

Translated by