How to plot all data points on one graph

12 ビュー (過去 30 日間)
Nicole Cichon
Nicole Cichon 2020 年 9 月 27 日
コメント済み: Nicole Cichon 2020 年 9 月 27 日
This is my code so far:
for R = [0.8 0.85 0.9 0.95 0.99]
y = 3;
high3 = 1-((1-R^y)^2)
end
% n=4
for R = [0.8 0.85 0.9 0.95 0.99]
y = 4;
high4 = 1-((1-R^y)^2)
end
%n=5
for R = [0.8 0.85 0.9 0.95 0.99]
y = 5;
high5 = 1-((1-R^y)^2)
end
% n = 3
for R = [0.8 0.85 0.9 0.95 0.99]
y = 3;
low3 = (1-(1-R)^2)^y
end
% n = 4
for R = [0.8 0.85 0.9 0.95 0.99]
y = 4;
low4 = (1-(1-R)^2)^y
end
% n = 5
for R = [0.8 0.85 0.9 0.95 0.99]
y = 5;
low5 = (1-(1-R)^2)^y
end
Each loop's output is five different numbers. I want all the outputs to be plotted on one plot. How do I do this?

採用された回答

madhan ravi
madhan ravi 2020 年 9 月 27 日
R = [0.8 0.85 0.9 0.95 0.99];
y = 1 : numel(R);
high = 1-((1-R.^y).^2);
plot(R, y) % follow the same for low
  1 件のコメント
Nicole Cichon
Nicole Cichon 2020 年 9 月 27 日
Thank you for your answer!
After playing around with it, this code worked:
for R = [0.8 0.85 0.9 0.95 0.99]
y = [3 4 5]
high = 1-((1-R.^y).^2);
low = (1-(1-R).^2).^y;
plot(R,high,'b-x')
hold on
plot(R,low,'r-x')
xlim([0.8,1]);
ylim([0.4,1]);
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by