## plotting a logarithmic LCD graph --- solved!

4 posts / 0 new
Author
Message

Hey guys,

I have hit a little bump in developing a graph plotting routine. I need to generate a graph to display the results in a logarithmic fashion.

I can get the plot to work (with out the log function) but as you can gather the plot goes outside the graph area.

I am trying to plot VSWR figure values are from 1.001 to infinity with the usable range 1 to 5 or 6

I searched but either don't fully understand the math terminology or cant find a good resource to understand how to scale the numbers accordingly.

Any ideas or pointers chaps?

Regards
Nigel

Last Edited: Mon. Jan 20, 2014 - 10:05 PM

If you want to scale a curve (but adaptative scales can be misleading), it does not depend whether you are logarithmic and not.

suppose Y_SCR_MIN (resp Y_SCR_MAX) is the minimum (rsp maximum) y-coordonate in screen's units (it does not vary in the micro's world)
suppose y_min (resp y max) is the minimum (resp maximum) of the curve you want to draw, y_current is the current measure which should be displayed at y_current_screen;
y_current_screen is deduced from the screen's geometry and the curve evolution by:

`y_current_screen=Y_SCR_MIN + (Y_SCR_MAX-Y_SCR_MIN) (y_current - y_min)/(y_max - y_min); `

y_max and y_min *must* be computed before drawing the curve (one needs an array to
*store data to be ploted;
*compute the extrema
* change the scale;
this is not real time)

Thanks dbrion,

looking at this I really don't need the figures above 3.5 or 4 so will just ignore those figures and maybe plot as solid colour say red as being too large.

makes it much easier!

regards
Nigel

I have just found a function fscale

Just the thing I needed

float fscale( float originalMin, float originalMax, float newBegin, float
newEnd, float inputValue, float curve)

magic part of this is the "curve value" makes it fit lovely.

as a bonus it makes plotting easy as you can invert by switching numbers.

Regards
Nigel