Plot Maxwell-Boltzmann Equation w/ MATLAB Code

  • MATLAB
  • Thread starter foobag
  • Start date
  • Tags
    Code Matlab
In summary, the conversation is about trying to plot a Maxwell-Boltzmann Equation curve that shows the probability of opening an ion gated channel. The issue is that the output is showing a constant horizontal line at 0.5 probability, which doesn't make sense. The code is provided and there is a discussion about initializing the value of z and the values used in the exponential expression. The final explanation is that the exponential is evaluating to 1 due to the numbers used, resulting in the constant output.
  • #1
foobag
75
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
  • #2
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.
 
  • #3
sorry about that z was intialized to 2, i still get an almost straight line instead of a parabolic distribution that should be evident
 
  • #4
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.
 
  • #5
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.
 

Related to Plot Maxwell-Boltzmann Equation w/ MATLAB Code

What is the Maxwell-Boltzmann Equation?

The Maxwell-Boltzmann equation is a mathematical expression used in statistical mechanics to describe the distribution of particles in a gas at a given temperature. It relates the kinetic energy of the particles to the probability of finding them at a particular speed.

What is the significance of the Maxwell-Boltzmann Equation?

The Maxwell-Boltzmann equation is significant because it allows scientists to calculate the distribution of particles in a gas and understand how temperature affects the behavior of particles. It also helps in predicting the behavior of gases in various conditions, such as in chemical reactions or in a vacuum.

What is the formula for the Maxwell-Boltzmann Equation?

The formula for the Maxwell-Boltzmann equation is: f(v) = (m/2πkT)^(3/2) * 4πv^2 * e^(-mv^2/2kT) where f(v) is the probability density function, m is the mass of the particle, k is the Boltzmann constant, T is the temperature, and v is the speed of the particle.

How can the Maxwell-Boltzmann Equation be plotted with MATLAB code?

To plot the Maxwell-Boltzmann equation with MATLAB, you can use the plot function and input the formula using the appropriate variables. For example, the code could look like this: plot(v, (m/2*pi*k*T)^(3/2) * 4*pi*v.^2 * exp(-m*v.^2/(2*k*T)). This will generate a graph showing the distribution of particles at a given temperature.

What are the assumptions made in the Maxwell-Boltzmann Equation?

Some of the assumptions made in the Maxwell-Boltzmann equation include that the particles in the gas are in constant motion, that they do not interact with each other, and that their speed follows a normal distribution. Additionally, it assumes that the particles are in thermal equilibrium, meaning they have the same temperature.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
507
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
414
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
41
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
Back
Top