Graph keeps coming up blank
1 view (last 30 days)
Show older comments
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')
0 Comments
Accepted Answer
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.
More Answers (0)
See Also
Categories
Find more on Blue in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!