Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Logarithmic Surface Plot

Subject: Logarithmic Surface Plot

From: Alex Thiele

Date: 14 Nov, 2008 08:20:19

Message: 1 of 5

Hello All,

I am generating a 'Moving' Allan Variance script, and cannot figure out how to create a logarithmic surface plot.

I have a 30x100 array. Row 1 contains my x axis data (time interval) which will be the same for all the data. And Rows 2:30 contain 29 sets of y axis data. (which would all be plotted against my row 1 data)

So I have 29 sets of data that I would like to plot next to each other in a 3D plot and see how the graphs vary with time. Normally I would just do a loglog to plot one instance of the data. I tried logging the data before hand, but then obviously, all the axes scales were incorrect.

Does anyone know if this is possible?

Many thanks

Subject: Logarithmic Surface Plot

From: Walter Roberson

Date: 14 Nov, 2008 15:42:21

Message: 2 of 5

Alex Thiele wrote:
> I am generating a 'Moving' Allan Variance script, and cannot figure out how to create
> a logarithmic surface plot.

Matlab will not do surfaces in with [XYZ]Scale set to 'log'

> I tried logging the data before hand, but then obviously, all the axes scales were incorrect.

Set the [XYZ]TickLabel properties if it is just the labeling that is the problem.
But if you need to be able to zoom or pick points with ginput() when your data
has been log()'d ahead of time, then Yes, you are going to have difficulties.

--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Subject: Logarithmic Surface Plot

From: Alex Thiele

Date: 17 Nov, 2008 14:20:18

Message: 3 of 5

Thanks for the reply.

Yes, I need proper scaling. I dont want to have to perform antilogs on my data in order to get the proper reading from the plot!

Hmm, it would seem this is not possible. Thanks anyway!

Subject: Logarithmic Surface Plot

From: Steven Lord

Date: 17 Nov, 2008 14:36:45

Message: 4 of 5


"Walter Roberson" <roberson@hushmail.com> wrote in message
news:c%gTk.7044$Oq2.5807@newsfe08.iad...
> Alex Thiele wrote:
>> I am generating a 'Moving' Allan Variance script, and cannot figure out
>> how to create
>> a logarithmic surface plot.
>
> Matlab will not do surfaces in with [XYZ]Scale set to 'log'

Sure it will, as long as the data in the appropriate dimension is positive.


[x, y, z] = peaks;

% All of x, y, and z contain negative values, so we need to translate them
minx = min(x(:));
miny = min(y(:));
minz = min(z(:));

% 2 is a semi-arbitrary "fudge factor", designed to make absolutely sure
% that none of the matrix elements even come close to 0
surf(x+abs(minx)+2, y+abs(miny)+2, z+abs(minz)+2);

% Set all three axes to be log scale
set(gca, 'XScale', 'log', 'YScale', 'log', 'ZScale', 'log')


I also tried changing the *Scale properties before SURFing, and as long as I
added the commands:

view(3); hold on

to set the axes view to the 3d view and hold the *Scale property values
before calling SURF, it worked.

--
Steve Lord
slord@mathworks.com

Subject: Logarithmic Surface Plot

From: Alex Thiele

Date: 17 Nov, 2008 17:41:02

Message: 5 of 5

> % Set all three axes to be log scale
> set(gca, 'XScale', 'log', 'YScale', 'log', 'ZScale', 'log')

Hey, it's as easy as that! There's always a simple solution! Now the only bit left to make it perfect, is to sort the colormap out! Now that I have a logarithmic surface plot, my surface color is pretty much the same! i.e. you can't see any variation because of the log scale! Hmmmm....

Thanks for the help!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us