Multiple Curve intersection plot
Show older comments
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 Comments
dpb
on 2 May 2019
Sure, it's doable--just have to have a way to pick the first point. Ideally, if had a functional form for the two curves makes it simpler but can be done from datapoints only if must.
To help others help you, attach the data from which to make a working example...
Okita Sugoo
on 2 May 2019
Okita Sugoo
on 2 May 2019
dpb
on 2 May 2019
We can't do anything useful with images; attach the data as files and your code for starting point...
Answers (1)
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.

Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
