MATLAB Answers

Multiple Curve intersection plot

9 views (last 30 days)
Okita Sugoo
Okita Sugoo on 2 May 2019
Edited: dpb on 3 May 2019
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:
*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


Show 1 older comment
Okita Sugoo
Okita Sugoo on 2 May 2019
these are the data used in plotting the curves above.
dpb on 2 May 2019
We can't do anything useful with images; attach the data as files and your code for starting point...

Sign in to comment.

Answers (1)

dpb on 3 May 2019
Edited: dpb on 3 May 2019
Actually, after looking at the drawings some more, I realize you did supply enough originally to make an initial pass at it...
Isc=[nan;220;335;nan]; % for missing data --> NaN
%Point C=(26.5,288)
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 =
% 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 =
>> format bank
>> ans
ans =
>> interp1(If,Vph,C,'pchip') % use the pchip interpolation
ans =
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 long as you stay within the relatively narrow limits of the SCC curve, it's simply a two-step interpolation process as outlined above.


Sign in to comment.

Translated by