필터 지우기
필터 지우기

How can this probability function be entered?

조회 수: 1 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by