Graph keeps coming up blank

1 view (last 30 days)
Hannah
Hannah on 23 Feb 2014
Commented: Star Strider on 23 Feb 2014
Hello, this is the code I have. Every time I try to run it it gives me a blank figure. Do I need to use a for loop? If so, how should I do that?
T=[3000:30000]; gratio=4; deltaE=1.63e-18; k=1.38e-23;
nratio=gratio.*exp(deltaE./k.*T); %Boltzmann excitation formula
plot(T,nratio, 'r')
xlabel('Temperature (K)','fontsize',18, 'FontWeight','bold')
ylabel('Number of Atoms Ratio','fontsize',18, 'FontWeight','bold')
title('Boltzmann Excitation Formula as it Varies with Temperature','fontsize',18, 'FontWeight','bold')

Accepted Answer

Star Strider
Star Strider on 23 Feb 2014
Edited: Star Strider on 23 Feb 2014
I had to search on the Boltzmann Excitation Formula to be sure, but I believe this is what you want:
nratio=gratio.*exp(deltaE./(k.*T));
The product (k.*T) is supposed to be in the denominator. (You were calculating deltaE./k and then multiplying it by T. It was returning Inf for nratio.)
Note: You might consider semilogx, semilogy or loglog for your plot.
  2 Comments
Hannah
Hannah on 23 Feb 2014
Oh my goodness, thank you so much. It works just fine now, silly mistake.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!