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 个评论
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 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by