How can this probability function be entered?

2 ビュー (過去 30 日間)
Matthew Nanos
Matthew Nanos 2015 年 3 月 8 日
コメント済み: Star Strider 2015 年 3 月 9 日
I'm very new to matlab. I want to take this equation and use matlab to graph it:
I used this code
The variable P is created but it has a value for the first element, then all zeros.

採用された回答

Star Strider
Star Strider 2015 年 3 月 8 日
You have to vectorise your assignment for ‘P’:
k = 1.3806488E-23;
e = 6.0217657E-19;
z = 2;
Vh = 1E-3;
T1 = 25+273.15;
T2 = 37+273.15;
V = linspace(-0.1, 0.09);
VV = V-Vh;
P = 1./(1+exp(-z*e*(VV/(k*T1))));
figure(1)
plot(V, P)
grid
  2 件のコメント
Matthew Nanos
Matthew Nanos 2015 年 3 月 9 日
Thank you
Star Strider
Star Strider 2015 年 3 月 9 日
My pleasure!

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

その他の回答 (1 件)

Greig
Greig 2015 年 3 月 8 日
Change P to
P = (1./(1+exp(-z*e*(VV/(k*T1)))));
Since the (1+exp(..)) is a vector you have to use array division (./)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by