
Fill out Plot between V_Out1 and V_Out3
3 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I tried to fill out the Area between the 3 Plots described by the 3 functions (or rather only the upper and lower one) but it didn't work out as I wanted it to be. First I don't think I did the Interval correct because there is no break between -5 and 5kW and also I don't really know how to use the fill function (I just took it from a video from youtube).

2 件のコメント
回答 (2 件)
darova
2020 年 5 月 17 日
flip the data
xx1 = [t1 flip(t1)];
yy1 = [V_Out1 flip(V_Out3)];
xx2 = [t2 flip(t2)];
yy2 = [V_Out4 flip(V_Out6)];
patch(xx1,yy1,'r')
patch(xx2,yy2,'r')

1 件のコメント
darova
2020 年 5 月 17 日
Or use surf in this case
h1 = surf([t1;t1],[V_Out1;V_Out3],[t1;t1]*0);
h2 = surf([t2;t2],[V_Out4;V_Out6],[t2;t2]*0);
set([h1 h2],'facecolor','r','edgecolor','none')

Star Strider
2020 年 5 月 17 日
Add these patch calls:
patch([t1 fliplr(t1)], [V_Out2 fliplr(V_Out3)], 'r', 'FaceAlpha',0.1, 'EdgeColor','none') % V_Out2 & V_Out3
patch([t2 fliplr(t2)], [V_Out4 fliplr(V_Out6)], 'g', 'FaceAlpha',0.1, 'EdgeColor','none') % V_Out4 & V_Out6
so the complete code is now:
t1 = linspace(-108000,-5000,500);
t2 = linspace(5000,108000,500);
U_c1 = 4.75;
U_c2 = 5;
U_c3 = 5.25;
V_o = 2.5;
G = 6.667*10^(-3);
I_p11 = t1/399;
I_p12 = t2/399;
V_Out1 = (U_c1/5)*(V_o+G*I_p11);
V_Out2 = (U_c2/5)*(V_o+G*I_p11);
V_Out3 = (U_c3/5)*(V_o+G*I_p11);
V_Out4 = (U_c1/5)*(V_o+G*I_p12);
V_Out5 = (U_c2/5)*(V_o+G*I_p12);
V_Out6 = (U_c3/5)*(V_o+G*I_p12);
plot(t1,V_Out1,'c--');
hold on
plot(t1,V_Out2, 'g:');
plot(t1,V_Out3, 'b-.');
plot(t2,V_Out4,'c--');
plot(t2,V_Out5, 'g:');
plot(t2,V_Out6, 'b-.');
patch([t1 fliplr(t1)], [V_Out2 fliplr(V_Out3)], 'r', 'FaceAlpha',0.1, 'EdgeColor','none') % V_Out2 & V_Out3
patch([t2 fliplr(t2)], [V_Out4 fliplr(V_Out6)], 'g', 'FaceAlpha',0.1, 'EdgeColor','none') % V_Out4 & V_Out6
hold off
xlabel('Power in W');
ylabel('V_O_u_t');
legend('V_O_u_t_1','V_O_u_t_2', 'V_O_u_t_3');
Make appropriate changes to get the result you want.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!