Author |
Message |
Jim Fair (jim_fair)
Member Username: jim_fair
Post Number: 8 Registered: 02-2006
| Posted on Monday, March 19, 2007 - 03:12 pm: | |
I often need to use log plots for variables that may take on negative values. Using abs() doesn't seem to work. Is there a sure-fire way to process values prior to plotting to avoid passing negative values to the log plotting routines? |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 793 Registered: 06-2003
| Posted on Monday, March 19, 2007 - 04:21 pm: | |
What version are you running? I tried example contour and elevation plots with negative data and they worked correctly on versions 3,4 and 5. There is a built-in data cutoff at 1e-15*max. You can plot LOG(number) to control the number of decades of data retained. Or you can use a MAX function to cut off the data: Contour(MAX(data,limit)) LOG If ALL your data is negative, then probably the cutoff won't work. ABS still allows a zero, which is illegal (the computer cant represent -infinity). You could use a MAX(ABS(),limit) if all the data are negative.
|
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 794 Registered: 06-2003
| Posted on Monday, March 19, 2007 - 04:27 pm: | |
It just occurred to me that you must be trying to compute the log and plot it, rather than using the LOG qualifier in the plot command. Use CONTOUR(data) LOG or CONTOUR(data) LOG(6)
|
Jim Fair (jim_fair)
Member Username: jim_fair
Post Number: 9 Registered: 02-2006
| Posted on Monday, March 19, 2007 - 07:42 pm: | |
I see now that some of my troubles are coming from zeros being passed through. Adding a small number after the abs() fixed that. thanks. |