Filter löschen
Filter löschen

How to find x value for certain y value of a lineplot in matlab

1 Ansicht (letzte 30 Tage)
I want to get EV value at P=50% without real data point at P=0.5 in the lineplot.
  1 Kommentar
佳丽 周
佳丽 周 am 8 Jun. 2022
EV=[-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]
P=[0.0312500000000000,0,0.0312500000000000,0.0156250000000000,0.00625000000000000,0.0208333333333333,0.0186011904761905,0.0429687500000000,0.0282118055555556,0.0312500000000000,0.0539772727272727,0.0758838383838384,0.130080856643357,0.158545100732601,0.256227106227106,0.439955357142857,0.648752289377290,0.705156822344322,0.740785256410257,0.809659090909091,0.869444444444444,0.903125000000000,0.912946428571429,0.949218750000000,0.971726190476191,0.989583333333333,0.987500000000000,0.992187500000000,0.968750000000000,1,1]

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Torsten
Torsten am 8 Jun. 2022
EV = EV(5:14);
P = P(5:14);
EV_05 = interp1(P,EV,0.5)
  7 Kommentare
Torsten
Torsten am 8 Jun. 2022
Explanation: You have to choose an interval for P where the values are monotonically increasing. Otherwise, you'll get NaN from the interpolation. Since this is not the case for your complete P vector, I only took the values from P(10) to P(20).
佳丽 周
佳丽 周 am 8 Jun. 2022
Before posting online, I tried to fit a linear equation according to the nearest two data points. But I didn't get what I want proprely. May be chose a larger interval will be better fit my data.Thanks for your good explanation!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

SALAH ALRABEEI
SALAH ALRABEEI am 8 Jun. 2022
You can find the the EV from the index of p value.
Example;
a=[4,2,3,5,6,7]
a = 1×6
4 2 3 5 6 7
b = a.^2
b = 1×6
16 4 9 25 36 49
Now, to find what is a at b= 9!
inx = find(b==9);
a(inx)
ans = 3
  2 Kommentare
佳丽 周
佳丽 周 am 8 Jun. 2022
Thanks,but it doesn't work for my data.In your example,I want to find specific "a" value when b' doesn't exist in real ”b“.
Sam Chak
Sam Chak am 8 Jun. 2022
If the specific data and governing equation are unavailable, then you can only rely on Interpolation and Approximation Theory to find out the value.
More importantly, can you furnish the 17 visible data points (EV, P) for one-step further investigation of your NaN result?

Melden Sie sich an, um zu kommentieren.


Sam Chak
Sam Chak am 8 Jun. 2022
No joke, but this is the graphical approach.
  2 Kommentare
佳丽 周
佳丽 周 am 8 Jun. 2022
Okk! I got what your meaning.Interpolation work for my data finally.Your graph is pretty straightforward and cute.Thanks for your assitance
Sam Chak
Sam Chak am 8 Jun. 2022
Bearbeitet: Sam Chak am 8 Jun. 2022
Cute? Vote if you think it is cute, but I guess you are probably cuter, Ms. Zhou 😊

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interpolation 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!

Translated by