Have x find y

3 ビュー (過去 30 日間)
androSLO
androSLO 2014 年 1 月 18 日
回答済み: androSLO 2014 年 1 月 19 日
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 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 19 日
androSLO commented
How to do that?

サインインしてコメントする。

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 18 日
x=0:0.1:10;
y1=cos(x);
y2=sin(x);
x1=2.234
y11=interp1(x,y1,x1)
Y21=interp1(x,y2,x1)

その他の回答 (3 件)

Image Analyst
Image Analyst 2014 年 1 月 18 日
You can use spline() or polyfit() to get the value at "in between" locations.
  1 件のコメント
Image Analyst
Image Analyst 2014 年 1 月 18 日
Actually it's easier to just do what Azzi showed you.

サインインしてコメントする。


androSLO
androSLO 2014 年 1 月 19 日
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 件のコメント
Amit
Amit 2014 年 1 月 19 日
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 2014 年 1 月 19 日
Thank you it works now :) Thank you very muuchh :)

サインインしてコメントする。


androSLO
androSLO 2014 年 1 月 19 日
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?

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by