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 Comment

Azzi Abdelmalek
Azzi Abdelmalek on 19 Jan 2014
androSLO commented
How to do that?

Sign in to comment.

 Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 18 Jan 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)

More Answers (3)

Image Analyst
Image Analyst on 18 Jan 2014

0 votes

You can use spline() or polyfit() to get the value at "in between" locations.

1 Comment

Image Analyst
Image Analyst on 18 Jan 2014
Actually it's easier to just do what Azzi showed you.

Sign in to comment.

androSLO
androSLO on 19 Jan 2014

0 votes

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 Comments

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 on 19 Jan 2014
Thank you it works now :) Thank you very muuchh :)

Sign in to comment.

androSLO
androSLO on 19 Jan 2014

0 votes

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?

Products

Asked:

on 18 Jan 2014

Answered:

on 19 Jan 2014

Community Treasure Hunt

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

Start Hunting!