Tryng to graph with for loop

1 回表示 (過去 30 日間)
Conor Drogalis
Conor Drogalis 2020 年 10 月 22 日
コメント済み: Conor Drogalis 2020 年 10 月 22 日
Mean=3;
Lamda=.33;
for i=1:0.25:10
s=exp(-Lamda*i);
H4=(1-((1-s)^3))
H5=(1-((1-s)^4));
H6=(1-((1-s)^5));
L3=(1-(1-(s))^2)^3;
L4=(1-(1-(s))^2)^3;
L5=(1-(1-(s))^2)^3;
end
plot(H4)
grid on
Trying to plot H4,H5,H6,L3,L4,L5
but wont plot only eturns array

採用された回答

VBBV
VBBV 2020 年 10 月 22 日
Dont use fractional increments for loops, Try this
Mean=3;
Lamda=.33;
for i=1:10 % integer increments only
s(i)=exp(-Lamda*i);
H4(i)=(1-((1-s(i))^3));
H5(i)=(1-((1-s(i))^4));
H6(i)=(1-((1-s(i))^5));
L3(i)=(1-(1-(s(i)))^2)^3;
L4(i)=(1-(1-(s(i)))^2)^3;
L5(i)=(1-(1-(s(i)))^2)^3;
end
plot(H4)
grid on
  1 件のコメント
Conor Drogalis
Conor Drogalis 2020 年 10 月 22 日
Thank You

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by