MATLAB Plot Maxwell-Boltzmann Equation w/ MATLAB Code

  • Thread starter Thread starter foobag
  • Start date Start date
  • Tags Tags
    Code Matlab
Click For Summary
The discussion centers on plotting the Maxwell-Boltzmann Equation to determine the probability of an ion-gated channel opening using MATLAB. The user encounters an issue where the output is a constant horizontal line at 0.5 probability, suggesting a problem with the input parameters. It is identified that the exponential term in the equation is evaluating to 1 due to the values used, resulting in a lack of variation in the output. The importance of properly initializing the variable z is noted, but even with z set to 2, the output remains nearly constant. The conversation emphasizes the need to adjust the input values to achieve the expected parabolic distribution in the plot.
foobag
Messages
75
Reaction score
0
Hi Guys,

I am trying to plot a simple Maxwell-Boltzmann Equation curve that shows me the probability of opening an ion gated channel. The issue I am having is the output shows me just a linear horizontal line that is around 0.5 probability which makes no sense given my inputs.

Please take a look at my code below and help me if possible:

>> q = 1.6*10^(-19);
>> V = -100:1:40;
>> k = 8.617*10^(-5);
>> P = 1./(1+ exp(-z*q*((V+15)./(k*293.15))));
>> plot(V,P);

Basically I am plotting voltage ranges on the effect of probability that the ion gated channel for a membrane is open. It is a divalence, with room temp, and Voltage at 0.5 probability is -15mV.
 
Physics news on Phys.org
foobag said:
>> P = 1./(1+ exp(-z*q*((V+15)./(k*293.15))));
What's the value of z? I'm guessing that you haven't initialized it, so you're getting P = 1/(1 + 1) = 0.5.

By not initializing z, the value of your exponential expression is just 1.
 
sorry about that z was intialized to 2, i still get an almost straight line instead of a parabolic distribution that should be evident
 
Is P defined as an array? Is there some sort of do loop that calculates values for P? It would probably be helpful if you provided your complete code.
 
If z wasn't initialized, there would be an error. It wouldn't be treated as 0. Also, the code as shown is complete and will run as is, provided z set equal to 2.

The reason you are getting a constant 0.5 is simply because the exponential is evaluating to 1 given your numbers. (V+15)/ (kB T) is ranging from about -3000 to 2000, while you are multiplying it by q = 1.6 x 10^-19. That gives you something on the order of 10^-16, the exponential of which is 1 for all intents and purposes.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 41 ·
2
Replies
41
Views
10K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 14 ·
Replies
14
Views
3K