Have x find y

1 visualización (últimos 30 días)
androSLO
androSLO el 18 de En. de 2014
Respondida: androSLO el 19 de En. de 2014
Hello,
I have one problem which i can't solve.
I have x = [...], y1=[...], y2=[..] And i have made plot in one graph. Now i want with specific X (is 230) find y1 and y2 on graph and write it out that i can know which value is y1 and y2 on this x.
Thanks in advance. Regards, Andrej
  1 comentario
Azzi Abdelmalek
Azzi Abdelmalek el 19 de En. de 2014
androSLO commented
How to do that?

Iniciar sesión para comentar.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 18 de En. de 2014
x=0:0.1:10;
y1=cos(x);
y2=sin(x);
x1=2.234
y11=interp1(x,y1,x1)
Y21=interp1(x,y2,x1)

Más respuestas (3)

Image Analyst
Image Analyst el 18 de En. de 2014
You can use spline() or polyfit() to get the value at "in between" locations.
  1 comentario
Image Analyst
Image Analyst el 18 de En. de 2014
Actually it's easier to just do what Azzi showed you.

Iniciar sesión para comentar.


androSLO
androSLO el 19 de En. de 2014
It doesn't go.. I have this form done till now:
y1=[52.50 48.75 30 20 13.75 10 7.50 5 3]; x=[253 241 207 184 161.1 137.8 114.6 92.3 68.8]; y2=[0.683 0.586 0.347 0.237 0.157 0.117 0.092 0.075 0.060];
%figure 1
[AX,H1,H2] = plotyy(x,y1,x,y2,'plot'); set(get(AX(1),'Ylabel'),'String','P_1_0 [W]') set(get(AX(2),'Ylabel'),'String','I_1_0 [A]') xlabel('U_1_0 [V]') grid on
And i have known X=230, and have to find y1 and y2 on this X..
  2 comentarios
Amit
Amit el 19 de En. de 2014
Azzi code was generalized. It will work for your case as well.
x1 = 230;
y11=interp1(x,y1,x1)
Y21=interp1(x,y2,x1)
y1l and y2l are interpolated values at x = 230.
androSLO
androSLO el 19 de En. de 2014
Thank you it works now :) Thank you very muuchh :)

Iniciar sesión para comentar.


androSLO
androSLO el 19 de En. de 2014
Now i have another question.. I have 3 y axes and one x axis. I have one y axis on right side and two on left side.. I want that they all three are on right side and one next to the other?

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by