How to make a curve fill the whole plotspace

1 回表示 (過去 30 日間)
Arne
Arne 2025 年 3 月 21 日
編集済み: Walter Roberson 2025 年 3 月 21 日
Vb0_vec = [10 1000];
mb_vec = (20*10^-3)*(36*pi*Vb0_vec.^2).^(1/3);
rhog0 = 0.169;
lambda = 0.0173;
y = linspace(0, 120000, 50000);
% plot 3: beperkende factor voor capaciteit
W_10 = Capaciteit(y, Vb0_vec(1), lambda, mb_vec(1), rhog0);
W_1000 = Capaciteit(y, Vb0_vec(2), lambda, mb_vec(2), rhog0);
figure(3)
loglog(y, W_10)
hold on
loglog(y, W_1000)
hold off
The output looks like this:
How can i make the curves cover the whole plot (touching both axes)?

採用された回答

Walter Roberson
Walter Roberson 2025 年 3 月 21 日
編集済み: Walter Roberson 2025 年 3 月 21 日
You have the same y each time, but the visible coverage is different. For log plots the implication is that the data either becomes non-finite or becomes negative.
[min10, max10] = bounds(y(isfinite(W_10) & (W_10>0)));
[min1000, max1000] = bounds(y(isfinite(W_1000) & (W_1000>0)));
minb = min(min10, min1000);
maxb = max(max10, max1000);
xlim([minb, maxb]);

その他の回答 (1 件)

Mathieu NOE
Mathieu NOE 2025 年 3 月 21 日
hello
try this :
have log spaced x vector (with power of 10 limits) should do the job (fastest fix)
and 500 to 1000 points should be enough to get a good quality plot
Vb0_vec = [10 1000];
mb_vec = (20*10^-3)*(36*pi*Vb0_vec.^2).^(1/3);
rhog0 = 0.169;
lambda = 0.0173;
% y = linspace(0, 120000, 50000);
y = logspace(1, 5, 1000);
% plot 3: beperkende factor voor capaciteit
W_10 = Capaciteit(y, Vb0_vec(1), lambda, mb_vec(1), rhog0);
Unrecognized function or variable 'Capaciteit'.
W_1000 = Capaciteit(y, Vb0_vec(2), lambda, mb_vec(2), rhog0);
figure(3)
loglog(y, W_10)
hold on
loglog(y, W_1000)
hold off
  2 件のコメント
Arne
Arne 2025 年 3 月 21 日
Thank you for your answer. Your suggestion fixes the problem on the left side. On the right side however the graphs don't go all the way down to zero. I think i would need a way to have the points on the right side be closer to eachother.
Mathieu NOE
Mathieu NOE 2025 年 3 月 21 日
hello again
can you share your function Capaciteit ?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeRepeated Measures and MANOVA についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by