Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Logarithmic Plotting Question

  1. May 12, 2007 #1
    1. The problem statement, all variables and given/known data

    I have a function of temperature, and I am asked to do the following:

    "Plot it in logarithmic scale as a function of the logarithm of temperature"

    3. The attempt at a solution

    Does this mean I just make the horizontal axis, T, a logarithmic numberline?

    Or do I have to actually plot my function f(T) as f(ln(T)), and just have relatively small numbers on the x-axis numberline?

    While the second option seems to literally be what the question is asking me to do, I don't see the point! You loose the ability to see T on the x-axis! (Instead you see numbers for ln(T) which is not intuitive) Both plots look basically the same, so why would the question ask me to do the latter option??

  2. jcsd
  3. May 12, 2007 #2
    It may not be intuitive because you aren't so used to it. There are some things, like spectral power, that I couldn't even imagine not being on a log scale and would almost be non-intuitive for it not to be.

    If your temperature varies exponentially, then the log scale can tidy up the data, and show relationships that are not otherwise obvious.

    Hard to say without seeing your data though. Could you somehow post it?
  4. May 12, 2007 #3
    Yeah, it's just three functions of temperature for the effective conduction band density of states for Si, Ge, and GaAs. After doing all the computations, here are the 3 functions:

    [tex] N_{c,Si} = 5.447\times 10^{20} \cdot T^{3/2}[/tex]
    [tex] N_{c,Ge} = 2.03\times 10^{21} \cdot T^{3/2}[/tex]


    [tex] N_{c,GaAs} = 8.38\times 10^{19} \cdot T^{3/2}[/tex]

    So I just set up an array in Matlab for T values from 1 to 1000 Kelvin, then took the natural log of the array and plotted each of these functions as a function of these logarithms rather than of T. (I just substituted T for ln(T) in each of the above equations)

    If you are familiar with matlab, my code was:

    Code (Text):

    T1 = 0.1:.1:1000
    T = log(T1)
    NcSi = 5.447e20*T.^(3/2)
    NcGe = 2.0343e21*T.^(3/2)
    NcGaAs = 8.375e19*T.^(3/2)
    Then I adjusted the y-axis in the figure editor to make it logarithmic as well. Do you think I'm doing it correctly?

    Here's a picture:

    http://img223.imageshack.us/img223/8372/curveshp4.th.jpg [Broken]
    Last edited by a moderator: May 2, 2017
  5. May 13, 2007 #4
    Ah, okay, so your original data is some kind of exponential function. If you take the ln or log of the y-axis then it should work out.

    Say you have a function
    y(x) = e^(Tx) + B

    if you take natural log

    ln(y(x))=Y(x)= Tx + lnB

    now the function Y(x) is linear, and you can figure out the time constant, decay constant, whatever from the slope of the new linear function.

    Sorry this is brief, I could explain the slope part, but my laptop battery is about to die and if you can figure it out :).

    Also, just now looking at your code I see that it is not an exponential function, so this doesn't work. I'll look at the problem a little later.
    Last edited: May 13, 2007
  6. May 13, 2007 #5
    So, in general the purpose is going to be to take some function that varies by some sort of power and make it a straight line. If you take the log of both the function and the dependent variable then you will get a straight line.

    In your code you are dotting the log of the temperature vector to the power of (3/2), where as you want to be taking the normal data, without the log, and getting your data points. Then take those normal data points and take the log of them. If you then plot the log of those points with the log of the temperature vector, you should get a straight line and a "log plot."

    Do something like
    Code (Text):

    %find data points
    T1 = 0.1:.1:1000;
    NcSi = 5.447e20*T1.^(3/2);
    NcGe = 2.0343e21*T1.^(3/2);
    NcGaAs = 8.375e19*T1.^(3/2);
    %log stuff
    T = log(T1);
    LNcSi = log(NcSi);
    LNcGe = log(NcGe);
    LNcGaAs = log(NcGaAs);
    %plot stuff
    xlabel('Log Temperature')
    ylabel('Log Rating(?)')
  7. May 13, 2007 #6
    Thanks, Mindscrape. I really appreciate the time you've taken to help me out!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook