Not plotting all the values in a single graph

x = -10:0.1:10;
a = [1 3 5];
figure(1)
for i = 1:3
u(1,:) = (1/4*a(i))*(1+erf(x+a(i)/sqrt(2)) - (1+erf(x-a(i)/sqrt(2))));
plot(x,u(i,:))
end
hold on
grid on
xlabel('x')
ylabel('CDF')
legend('a=1','a=2','a=3','Location','best')
title('CDF of normal distribution with \sigma = 1')

 採用された回答

KSSV
KSSV 2019 年 4 月 29 日

1 投票

x = -10:0.1:10;
a = [1 3 5];
figure(1)
u = zeros(length(a),length(x)) ;
for i = 1:length(a)
u(i,:) = (1/4*a(i))*(1+erf(x+a(i)/sqrt(2)) - (1+erf(x-a(i)/sqrt(2))));
end
plot(x,u)
hold on
grid on
xlabel('x')
ylabel('CDF')
legend('a=1','a=2','a=3','Location','best')
title('CDF of normal distribution with \sigma = 1')

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

質問済み:

2019 年 4 月 29 日

回答済み:

2019 年 4 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by