Multiple Curve intersection plot

조회 수: 4 (최근 30일)
Okita Sugoo
Okita Sugoo 2019년 5월 2일
편집: dpb 2019년 5월 3일
Hello,
I have 3 vectors : Vph, If & Isc
I plot Vph versus If (O.C.C) and Isc versus If (S.C.C)
after plotting the two curves i need to draw a horizontal line from a value of Isc vector(Ifl) until it touches the S.C.C curve at Point C and draw a vertical line from that point that touch the O.C.C curve at point B and find the value of Vph at this point(Point B)
i this possible in matlab ?
so far i was managed to draw the horizontal line but i'm unable to get the point where it touches the S.C.C curve.
any guidance would be appreciated.
Worked Exampe:
Ifl=288
Vph=[450;900;1150;1320]
If=[10;20;30;40]
Isc=[---;220;335;---]
*the dashed lines meanes that theres no registered value of Isc to the corresponding value of If.
Point C=(26.5,288)
Vph at Pt B =1060
  댓글 수: 4
Okita Sugoo
Okita Sugoo 2019년 5월 2일
IMG_20190503_003206.jpg
dpb
dpb 2019년 5월 2일
We can't do anything useful with images; attach the data as files and your code for starting point...

댓글을 달려면 로그인하십시오.

답변 (1개)

dpb
dpb 2019년 5월 3일
편집: dpb 2019년 5월 3일
Actually, after looking at the drawings some more, I realize you did supply enough originally to make an initial pass at it...
Ifl=288;
Vph=[450;900;1150;1320];
If=[10;20;30;40];
Isc=[nan;220;335;nan]; % for missing data --> NaN
%Point C=(26.5,288)
plot(If,Vph)
hold on,plot(If,Isc)
xlim([0 50]), ylim([0 1500])
% results in sorta' like the drawing plot...looks better if
IfInterp=linspace(If(1),If(end),50); % more points to smooth curve
VphInterp=interp1(If,Vph,IfInterp,'pchip'); % use shape-keeping cubic piecewise poly
plot(IfInterp,VphInterp,'k-') % and show what that looks like...
C=interp1(Isc(2:3),If(2:3),Ifl) % find intersection @ Ifl
C =
25.9130
% result doesn't quite match your value...neighborhood but not actual intersection
% now look for intersection of Vph at C...
>> interp1(If,Vph,C) % linear interpolation
ans =
1.0478e+03
>> format bank
>> ans
ans =
1047.83
>> interp1(If,Vph,C,'pchip') % use the pchip interpolation
ans =
1061.38
>>
The last value is quite close to your estimate...
All you need to do is wrap the above in a function; drawing the horizontal and vertical lines on the plot shouldn't be difficult...as long as you stay within the relatively narrow limits of the SCC curve, it's simply a two-step interpolation process as outlined above.
untitled.jpg

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by