필터 지우기
필터 지우기

get the x-value of a point on curve

조회 수: 11 (최근 30일)
ahmed salah
ahmed salah 2020년 2월 20일
댓글: the cyclist 2020년 2월 20일
I draw a curve between two vector of points, not a function, how can I get the x-value of a certain y-value of the curve?
  댓글 수: 2
Jon
Jon 2020년 2월 20일
Please post your code
ahmed salah
ahmed salah 2020년 2월 20일
here is the curve
x=[0,0.250000000000000,0.500000000000000,0.750000000000000,1,1.25000000000000,1.50000000000000,1.75000000000000,2,2.25000000000000,2.50000000000000,2.75000000000000,3,3.25000000000000,3.50000000000000,3.75000000000000,4,4.25000000000000,4.50000000000000,4.75000000000000,5,5.25000000000000,5.50000000000000,5.75000000000000,6,6.25000000000000,6.50000000000000,6.75000000000000,7,7.25000000000000,7.50000000000000,7.75000000000000,8,8.25000000000000,8.50000000000000,8.75000000000000,9,9.25000000000000,9.50000000000000,9.75000000000000,10,10.2500000000000,10.5000000000000,10.7500000000000,11,11.2500000000000,11.5000000000000,11.7500000000000,12,12.2500000000000,12.5000000000000,12.7500000000000,13,13.2500000000000,13.5000000000000,13.7500000000000,14,14.2500000000000,14.5000000000000,14.7500000000000,15,15.2500000000000,15.5000000000000,15.7500000000000,16,16.2500000000000,16.5000000000000,16.7500000000000,17,17.2500000000000,17.5000000000000,17.7500000000000,18,18.2500000000000,18.5000000000000,18.7500000000000,19,19.2500000000000,19.5000000000000,19.7500000000000,20,20.2500000000000,20.5000000000000,20.7500000000000,21,21.2500000000000,21.5000000000000,21.7500000000000,22,22.2500000000000,22.5000000000000,22.7500000000000,23,23.2500000000000,23.5000000000000,23.7500000000000,24,24.2500000000000,24.5000000000000,24.7500000000000,25,25.2500000000000,25.5000000000000,25.7500000000000,26,26.2500000000000,26.5000000000000,26.7500000000000,27,27.2500000000000,27.5000000000000,27.7500000000000,28,28.2500000000000,28.5000000000000,28.7500000000000,29,29.2500000000000,29.5000000000000,29.7500000000000,30,30.2500000000000,30.5000000000000,30.7500000000000,31,31.2500000000000,31.5000000000000,31.7500000000000,32,32.2500000000000,32.5000000000000,32.7500000000000,33,33.2500000000000,33.5000000000000,33.7500000000000,34,34.2500000000000,34.5000000000000,34.7500000000000,35,35.2500000000000,35.5000000000000,35.7500000000000,36,36.2500000000000,36.5000000000000,36.7500000000000,37,37.2500000000000,37.5000000000000,37.7500000000000,38,38.2500000000000,38.5000000000000,38.7500000000000,39,39.2500000000000,39.5000000000000,39.7500000000000,40,40.2500000000000,40.5000000000000,40.7500000000000,41,41.2500000000000,41.5000000000000,41.7500000000000,42,42.2500000000000,42.5000000000000,42.7500000000000,43,43.2500000000000,43.5000000000000,43.7500000000000,44,44.2500000000000,44.5000000000000,44.7500000000000,45,45.2500000000000,45.5000000000000,45.7500000000000,46,46.2500000000000,46.5000000000000,46.7500000000000,47,47.2500000000000,47.5000000000000,47.7500000000000,48,48.2500000000000,48.5000000000000,48.7500000000000,49,49.2500000000000,49.5000000000000,49.7500000000000,50,50.2500000000000,50.5000000000000,50.7500000000000,51,51.2500000000000,51.5000000000000,51.7500000000000,52,52.2500000000000,52.5000000000000,52.7500000000000,53,53.2500000000000,53.5000000000000,53.7500000000000,54,54.2500000000000,54.5000000000000,54.7500000000000,55,55.2500000000000,55.5000000000000,55.7500000000000,56,56.2500000000000,56.5000000000000,56.7500000000000,57,57.2500000000000,57.5000000000000,57.7500000000000,58,58.2500000000000,58.5000000000000,58.7500000000000,59,59.2500000000000,59.5000000000000,59.7500000000000,60,60.2500000000000,60.5000000000000,60.7500000000000,61,61.2500000000000,61.5000000000000,61.7500000000000,62,62.2500000000000,62.5000000000000,62.7500000000000,63,63.2500000000000,63.5000000000000,63.7500000000000,64,64.2500000000000,64.5000000000000,64.7500000000000,65,65.2500000000000,65.5000000000000,65.7500000000000,66,66.2500000000000,66.5000000000000,66.7500000000000,67,67.2500000000000,67.5000000000000,67.7500000000000,68,68.2500000000000,68.5000000000000,68.7500000000000,69,69.2500000000000,69.5000000000000,69.7500000000000,70,70.2500000000000,70.5000000000000,70.7500000000000,71,71.2500000000000,71.5000000000000,71.7500000000000,72,72.2500000000000,72.5000000000000,72.7500000000000,73,73.2500000000000,73.5000000000000,73.7500000000000,74,74.2500000000000,74.5000000000000,74.7500000000000,75,75.2500000000000,75.5000000000000,75.7500000000000,76,76.2500000000000,76.5000000000000,76.7500000000000,77,77.2500000000000,77.5000000000000,77.7500000000000,78,78.2500000000000,78.5000000000000,78.7500000000000,79,79.2500000000000,79.5000000000000,79.7500000000000,80];
y=[-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-1000000000.00000;-999023914.181976;-996101369.470118;-991249448.402318;-984496437.005408;-975881550.135659;-965454552.197838;-953275278.375072;-939413062.813476;-923946081.405808;-906960617.887384;-888550262.878127;-868815056.262843;-847860583.886983;-825797039.950101;-802738266.700420;-778800783.071405;-754102813.758623;-728763329.919491;-702901112.199745;-676633846.161729;-650077259.426284;-623344308.959634;-596544425.958485;-569782824.730923;-543159880.858705;-516770582.779577;-490704059.767441;-465043188.134056;-439864276.347883;-415236828.681841;-391223385.978341;-367879441.171442;-345253426.344544;-323386767.337505;-302314001.257049;-282062951.693815;-262654956.011189;-244105138.745554;-226422724.943098;-209611387.151098;-193669619.776293;-178591134.612436;-164365271.515199;-150977418.455915;-138409435.506143;-126640077.682188;-115645412.001621;-105399224.561864;-95873413.9333128;-87038367.6562235;-78863319.1321027;-71316682.6977580;-64366365.1556118;-57980052.5002544;-52125471.0225585;-46770622.3839590;-41883992.6308008;-37434735.4590011;-33392830.3407140;-29729216.3861588;-26415903.0350821;-23426058.8540209;-20734079.8588388;-18315638.8887342;-16147717.6303287;-14208622.9311963;-12477989.0542226;-10936767.5106050;-9567206.07335306;-8352818.51808101;-7278346.56690364;-6329715.42748575;-5493984.22569959;-4759292.52969696;-4114804.05804821;-3550648.55724255;-3057862.72632757;-2628330.96056771;-2254726.58323161;-1930454.13622771;-1649593.20729371;-1406844.18457416;-1197476.24923513;-1017277.84361470;-862509.786462451;-729861.148096995;-616407.946691314;-519574.682154838;-437098.685902352;-366997.232797294;-307537.335293304;-257208.118800665;-214695.661081271;-178860.166527008;-148715.338006110;-123409.804086680;-102210.457403375;-84487.5602850465;-69701.4761011665;-57390.8887394688;-47162.3778574823;-38681.2237531849;-31663.3226067570;-25868.1002226541;-21092.3200481345;-17164.6889911202;-13941.1722657260;-11300.9360431463;-9142.84398775726;-7382.44074333424;-5949.36205084747;-4785.11739212903;-3841.19684131568;-3077.45915842322;-2460.76307630544;-1963.80822089881;-1564.15617842291;-1243.40590008523;-986.500936172905;-781.148940830449;-617.336511316966;-486.924746716508;-383.312956548538;-301.159744605734;-236.152261880159;-184.815787720481;-144.356982138370;-112.535174719259;-87.5569356105099;-67.9899287062702;-52.6926920127339;-40.7575393356832;-31.4642435108093;-24.2425556547795;-18.6419473328348;-14.3072419185677;-10.9590354849177;-8.37800305312445;-6.39234879527583;-4.86779390210820;-3.69960765354966;-2.80627950629673;-2.12450593559293;-1.60522805518561;-1.21050699313975;-0.911065565816399;-0.684358602861398;-0.513061702609176;-0.383890383971262;-0.286679499687312;-0.213667176299877;-0.158939100945165;-0.117998221631021;-0.0874323075473376;-0.0646576904591947;-0.0477221722017458;-0.0351537765491551;-0.0258449407447336;-0.0189640399835250;-0.0138879438649640;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000;1000000000.00000];
plot(x,y)

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2020년 2월 20일
When you say "get", do you mean from the vectors, or only from the curve?
If you mean from the data, you can do, for example
x(y==0.25)
(You might need to be careful if y is not exactly 0.25, due to floating point precision.)
  댓글 수: 2
the cyclist
the cyclist 2020년 2월 20일
My solution assumes the y value you are looking for is in the original vector. Sky Sartorius's solution is preferred if the y value is not in the original vector, but you want to interpolate.
ahmed salah
ahmed salah 2020년 2월 20일
Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sky Sartorius
Sky Sartorius 2020년 2월 20일
This is a table lookup / interpolation problem. For your data, you'll first have to make sure there aren't any repeated y values.
yQuery = -2.6e8; % Example query point.
[Y,ind] = unique(y,'stable')
X = x(ind);
x = interp1(Y,X,yQuery)
  댓글 수: 2
ahmed salah
ahmed salah 2020년 2월 20일
Thank you this worked for me
the cyclist
the cyclist 2020년 2월 20일
The best way to thank a contributor is to upvote and/or accept their answer. This rewards them with reputation points, and also directs future users to solutions.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by