Find X from Y in a graph
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
msij
am 26 Apr. 2016
Bearbeitet: msij
am 27 Apr. 2016
Hi,
I have plotted some x and y values to give me a hyperbola graph (I've attached the data in the excel file). I am trying to find what the x values are from a know y value but I am having some trouble.
An example:
From either the x/y values or the plotted graph; if y = -3.951, how can I find the corresponding x value?
I have looked around and most people recommend either using find (which I can't because the new y value won't definitely be in the given y values) or interp1. When I use interp1, it returns 'The grid vectors are not strictly monotonic increasing.'.
I used the line: x = interp1(y_values,x_values, m_A);
When I use,
x = interp1(x_values,y_values, -3.951);
I am returned with 'NaN'.
I'm not sure where to go from here. All help is appreciated.
Thanks!
EDIT:
Thanks for your help. I figured it out. I have decided to just separate out the x and y values so that they are unique. Then I can plot them oppositely.
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 26 Apr. 2016
Bearbeitet: Azzi Abdelmalek
am 26 Apr. 2016
Try
x = interp1(x_values,y_values, -3.951,'linear','extrap');
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Discrete Data Plots 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!