Hello I would like to find two values of x similar/close to 0.71 for the same value of y as shown in the image file.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi so basically, I want to find two values of x similar/close to that of roughly 0.71 for the same value of y within the matrix y. I've included the data for y where x is just 0 to 100 as shown in the image. For the purpose of showing the process, writing your own code on a different plot just to show the process would be great aswell.
y = [
0.999999995023660
0.999999991814002
0.999999986534167
0.999999977848923
0.999999963561839
0.999999940059818
0.999999901399380
0.999999837803596
0.999999733189591
0.999999561101321
0.999999278019104
0.999998812353973
0.999998046343801
0.999996786273318
0.999994713488149
0.999991303818118
0.999985695041822
0.999976468900306
0.999961292600459
0.999936329330312
0.999895269205729
0.999827736922888
0.999716677048434
0.999534065499866
0.999233889114869
0.998740689127159
0.997930962721728
0.996603231519677
0.994430568318047
0.990887148273905
0.985139441545625
0.975897419522911
0.961242086932429
0.938501414780253
0.904352722045625
0.855442758499713
0.789734116125554
0.708205898819358
0.615675218341402
0.519607646564184
0.427469716233927
0.344517090802763
0.273164773122668
0.213579071853642
0.164616002761310
0.124573735573943
0.0916395792308422
0.0640988427075723
0.0404006895873969
0.0191501289989020
0.000934022953099406
0.0210751530764663
0.0424995219595119
0.0664967361160067
0.0944749552272853
0.128000821681603
0.168802624911376
0.218694474841229
0.279349354068681
0.351825011494707
0.435784177170636
0.528558304967223
0.624631946570968
0.716424266944032
0.796615426401297
0.860731637474228
0.908136788561783
0.941065361802927
0.962913761580377
0.976959588334282
0.985803168481676
0.991297546938569
0.994682667150841
0.996757464203710
0.998025087243329
0.998798043885167
0.999268805858635
0.999555310312482
0.999729598844435
0.999835594743161
0.999900046985199
0.999939234132356
0.999963058583682
0.999977542504495
0.999986347712765
0.999991700588981
0.999994954691024
0.999996932903540
0.999998135481922
0.999998866541936
0.999999310960485
0.999999581126691
0.999999745363194
0.999999845204038
0.999999905898174
0.999999942794675
0.999999965224382
0.999999978859598
0.999999987148564
0.999999992187500]
0 Kommentare
Akzeptierte Antwort
KSSV
am 3 Okt. 2021
x = (1:length(y))' ;
idx = knnsearch(y,0.7,'k',2) ;
plot(x,y,'r')
hold on
plot(x(idx),y(idx),'*k')
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Red finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!