Understanding the transformation of values when plotting logscale.

17 views (last 30 days)
Hallo userbase,
I know this is more of a maths question than a MatLab question but hoping someone can give me a hand.
I'm playing with some transistor test data and having trouble understanding what is probably a very basic principle.
Below are my two graphs, plotted linearly and then with a logarithmic scale on the y axis. (Absolute vals for y taken.)
I understand that my linear values approach zero and log10(0) = -Inf, so the huge drop off in values as x->0 makes sense. But I haven't quite grokked converting back and forth yet.
I'm attempting to do some curve fitting to get the gradient in a pretty good linear region which can be used to calculate junction temperature etc. I'm plotting using semilogy, sighting a range to use as my linear region, then feeding that forward to perform the fitting. As the data stays in a protected structure, I want that range in terms of the non-log values (is it obvious my field is programming not maths..?).
How do I convert back? I can look at the graph and see that it is linear enough for my purposes between 10^-6 and 10^-1 but then how does that relate to my actual data?
log10(a) = b -> 10^b = a, yep, but using the range above:
10^(10^-6) = 1.0000023..
10^(10^-1) = 1.2589254..
And then I remembered I had taken the abs value so..
-10^(10^-6) = -0.9999..
-10^(10^-1) = -1.2589..
All of which are out of range of the original data.
I want to be able to say minY = someOperation(10^-6), maxY = someOperation(10^-2)
What do?
Thank you for reading, Marshall

Accepted Answer

dpb
dpb on 1 Dec 2014
Edited: dpb on 1 Dec 2014
The semilogy axes values are still linear values, not the log. log10 of 10^-1 or 10^-6 is -1 and -6, respectively. So the values of y are those values that are orders of magnitude different which shows that the linearity exists in the log space, not the linear space as is clear by the plots as those values correspond to the range from ~[-0.62, -0.3] on the x-axes and clearly that's not at all linear in the top plot.
It's been too long since my circuits days to recall the formulation but in the plot scale values alone you've not taken the log(*); look at the log of the values for the indices corresponding to those x ranges and you'll see the expected result of 10^logy.
(*) That is, while the values have been converted internally in the plot to be shown on a logarithmic axes, if you retrieve the line object 'ydata' property you'll see it is still the actual data, not log10(ydata).
  3 Comments
dpb
dpb on 2 Dec 2014
For plotting, no, you don't do anything except use semilogy as you've done; Matlab takes care of it internally.
It's why I say I've forgotten the circuits background enough that I don't recall the formulation precisely that when you do the fitting to estimate a set of parameters you will use log(y) there to be able to use linear regression. That help???
Marshall
Marshall on 4 Dec 2014
Yep, I see that I can generate a plot, the linear region of which will have the same gradient when the data is plotted on a log scale OR if the log of the data is taken and then plotted on a linear scale. My problem was that the data I'm working with is stored in a confusingly derived-from-dataset multidimensional structure and that makes things a little more hellish (-;
Thanks for the answer, was a great nudge in the right direction.

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!