Display negative values on logarithmic graph

Hi, I want to plot a set of data where the values oscillates around 0 but the amplitude decays exponentially. It is normally plotted with two different logarithmic yaxis on top of each other. With the lower one in reverse order. Can that be done in Matlab?

 채택된 답변

Grzegorz Knor
Grzegorz Knor 2012년 3월 8일

0 개 추천

Plot the logarithm of the absolute value of y multiplied by sign of y, and the change labels:
x = linspace(0,3,10000);
y = 1e6*exp(-x).*(sin(10*x)-0.5);
plot(x,y)
figure
Y = sign(y).*log10(abs(y));
plot(x,Y,'.')
yl = get(gca,'ytick');
set(gca,'yticklabel',sign(yl).*10.^abs(yl))

댓글 수: 2

bent
bent 2012년 3월 8일
Thank you, that's just what I wanted.
Ainray
Ainray 2023년 3월 22일
편집: Ainray 2023년 3월 22일
It give wrong ticks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Log Plots에 대해 자세히 알아보기

태그

질문:

2012년 3월 8일

편집:

2023년 3월 22일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by