loglog plot at high numbers

1 view (last 30 days)
Benjamin Cowen
Benjamin Cowen on 5 Feb 2016
Answered: Walter Roberson on 6 Feb 2016
Hi, I am having trouble plotting something in loglog plot.
I want to make a plot of n vs. T where n goes from 10^16 to 10^38 m^-3 and T goes 1 - 10^5 eV
And I have the equation 7.4 * sqrt (T/n);
How can I do this? I keep playing with the variables but I keep getting that my variable is too large etc.

Answers (2)

John D'Errico
John D'Errico on 5 Feb 2016
Must not be possible then. :)
n = 10.^(rand(1,100)*22 + 16);
T = 10.^(rand(1,100)*5);
loglog(T,n,'o')

Walter Roberson
Walter Roberson on 6 Feb 2016
The equation 7.4 * sqrt (T/n) involves both of your input variables n and T, so you are effectively asking for a 3D plot rather than a 2D plot.
n = logspace(16, 38);
T = logspace(0, 5);
[Gn, GT] = ndgrid(n,T);
eqn = 7.4 * sqrt(GT./Gn);
surf(Gn, GT, eqn, 'edgecolor', 'none');
set(gca, 'XScale', 'log', 'YScale', 'log', 'ZScale', 'log')
but you will not find the coloring to be interesting because coloring is based upon the original values not upon log() of the values. You might prefer
surf(Gn, GT, log(eqn), 'edgecolor', 'none');
set(gca, 'XScale', 'log', 'YScale', 'log', 'ZScale', 'linear')

Tags

Community Treasure Hunt

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

Start Hunting!