Trying to use patch to fill between two lines but no shading due to empty double row vector?
1 回表示 (過去 30 日間)
古いコメントを表示
I am trying to shade between z and v up to 0.725 but it just returns
idx =
1×0 empty double row vector
How do I get this to shade the space?
clear all
close all
clc
% V ideal
y = 0:10:35000;
x = 0:.01:0.9;
y = 14490 .* log( 1 ./ (1 - x));
% n max
z = 0:1:35000;
b = 0:0.01:0.9;
z = 14490 .* (log( 1 ./ (1 - b)) - ( 0.25 ) .* ( b ./ (1-b)));
% n = 1.1
v = 0:1:35000;
b = 0:0.01:0.9;
v = 14490 .* (log( 1 ./ (1 - b)) - (( 0.9091 ) .* b));
hold on
% All Functions Plotted
plot(x,y,'g');
plot(b,z,'r');
plot(b,v);
% Fill Area
idx = find(b==0.725)
patch([b(1:idx) fliplr(b(1:idx))],[z(1:idx) fliplr(v(1:idx))],'b')
% Labeling the Plot
title('\DeltaV vs. m_p/m_0')
xlabel('m_p/m_0')
ylabel('\DeltaV')
label1 = '\DeltaV Ideal';
label2 = '\eta_{max} = 4';
label3 = '\eta = 1.1';
legend(label1,label2,label3,'interpreter','tex')
hold off
0 件のコメント
回答 (1 件)
DGM
2022 年 2 月 26 日
That's because there is no x-value at that location due to its step size. See the comment on the prior question.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!