# Locate Y given X and display on the graph

2 visualizzazioni (ultimi 30 giorni)
RuiQi il 30 Dic 2014
Risposto: RuiQi il 30 Dic 2014
Hello ,
I have been trying to display the value of X and Y given either X or Y on my graph but am unable to do so. I would also like to be able to add in additional info/text and be able to re-size the box. The following was done through of the Data Cursor function which is not accurate. Please help , thanks.
Regards , Haziq
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (5)

Ilham Hardy il 30 Dic 2014
You can 'extract' the Data Cursor information to workspace for more accurate number. Right click on the data cursor point >> Export cursor data to workspace.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

RuiQi il 30 Dic 2014
Hello ,
Thanks for the response but what I meant was e.g. I would like to find the value of Y when X = 0.3. I have done so by sliding the Data Cursor along the graph to get as close as I can to 0.3 which is not accurate. I apologize for not being clear with my words.
Regards , Haziq
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Sean de Wolski il 30 Dic 2014
To do this correctly, you'd have to get the x/y data from the line and then use interp1 to get you the value of y at x == 3.

Accedi per commentare.

Sean de Wolski il 30 Dic 2014
Modificato: Sean de Wolski il 30 Dic 2014
h = plot(cumsum(rand(1,10)),rand(1,10));
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Ilham Hardy il 30 Dic 2014
If you generate the graph yourself using plot function, then simply interpolates your xpoint to find the applicable ypoint.
doc interp1
##### 2 CommentiMostra NessunoNascondi Nessuno
Sean de Wolski il 30 Dic 2014
Even if not generating the plot yourself, you could use findobj to traverse the graphics tree.
Ilham Hardy il 30 Dic 2014
Yes, very true. (i plan this as 'else' description)

Accedi per commentare.

RuiQi il 30 Dic 2014
Hello ,
Thanks for the function but it seems to not give the correct answer. The graph was plotted using the step() function.
My student research project requires MATLAB. Im sorry, I thought I could just jump straight into modelling and control after going through the tutorial videos but I guess im wrong. I need to learn MATLAB from scratch. This just feels so new.
Regards , Haziq
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by