Thread Subject: Log axis on surf plot

Subject: Log axis on surf plot

From: Paul

Date: 27 Aug, 2008 07:26:02

Message: 1 of 4

I noticed that the plot output in specgram (now obsolete and
called spectrogram) has been changed from 'image(...)' to
'surf(...)'

This is a welcome improvement.

But now I would like to use a log axis for the frequency
axis since my signal covers many decades in frequency
content. I realize the I can just form 'log10(f)' and plot
it as a linear axis but this is difficult to interpret when
analyzing the plot (e.g. what is the freq if log10(f)=0.4 ?)

Is there anyway to get a genuine log axis (1, 10 100, 1000)
in surf?


Subject: Log axis on surf plot

From: Steven Lord

Date: 27 Aug, 2008 13:01:49

Message: 2 of 4


"Paul " <par@ceri.memphis.edu> wrote in message
news:g92vi9$s6k$1@fred.mathworks.com...
>I noticed that the plot output in specgram (now obsolete and
> called spectrogram) has been changed from 'image(...)' to
> 'surf(...)'
>
> This is a welcome improvement.
>
> But now I would like to use a log axis for the frequency
> axis since my signal covers many decades in frequency
> content. I realize the I can just form 'log10(f)' and plot
> it as a linear axis but this is difficult to interpret when
> analyzing the plot (e.g. what is the freq if log10(f)=0.4 ?)
>
> Is there anyway to get a genuine log axis (1, 10 100, 1000)
> in surf?


[x,y,z] = peaks;
mz = min(z(:));
% I shift the z values in the SURF call below so that all the z coordinates
are positive
% that way, when I change the Z axis to be in log scale, all of the points
have a real logarithm
% and so can be shown on the plot.
surf(x, y, z-mz+1);
set(gca, 'ZScale', 'log')


You may also want to SET the ZTick and/or ZTickLabel properties to customize
the appearance of the axes. Look here for a list of properties of the axes
that you can SET:

http://www.mathworks.com/access/helpdesk/help/techdoc/infotool/hgprop/axes_frame.html

--
Steve Lord
slord@mathworks.com


Subject: Log axis on surf plot

From: giantnegro@yahoo.com

Date: 27 Aug, 2008 16:57:40

Message: 3 of 4

On Aug 27, 3:26=A0am, "Paul " <p...@ceri.memphis.edu> wrote:
> I noticed that the plot output in specgram (now obsolete and
> called spectrogram) has been changed from 'image(...)' to
> 'surf(...)'
>
> This is a welcome improvement.
>
> But now I would like to use a log axis for the frequency
> axis since my signal covers many decades in frequency
> content. =A0I realize the I can just form 'log10(f)' and plot
> it as a linear axis but this is difficult to interpret when
> analyzing the plot (e.g. what is the freq if log10(f)=3D0.4 ?)
>
> Is there anyway to get a genuine log axis (1, 10 100, 1000)
> in surf? =A0

I've been using surf(log10(f)), turning off the tick marks and labels
for the frequency axis, then creating another axis over that with the
appropriate log scale.
It's a serious pain and is probably not the best way to do it, but it
works.

Subject: Log axis on surf plot

From: Walter Roberson

Date: 27 Aug, 2008 17:26:09

Message: 4 of 4

Paul wrote:

> Is there anyway to get a genuine log axis (1, 10 100, 1000)
> in surf?

Set the axis XScale or YScale or ZScale property to be 'log'.
There are the usual issues about what happens to true 0's
(the points get dropped from the plot) but I don't see any
difficulty otherwise.

--
Q = quotation(rand);
if isempty(Q); error('Quotation server filesystem problems')
else sprintf('%s',Q), end

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
surf log axis Paul 27 Aug, 2008 03:33:09
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com