Filter löschen
Filter löschen

How do I change the values ​​of the axes?

2 Ansichten (letzte 30 Tage)
HelpAStudent
HelpAStudent am 11 Okt. 2021
Beantwortet: Star Strider am 11 Okt. 2021
Hi I have this plot:
figure; errorbar(y,e,'-o')
legend('Cist -9dB', 'Cist -6dB', 'Cist -3dB', 'Cist 3dB', 'Cist 6dB', 'Cist 9dB');
xlabel('Gain');
ylabel('Grey Levels');
title('Dynamic range of 20dB');
The x axis start from 0 to 21, because I have 21 one point, how can I make the axis start from -20dB to 20dB (every 2 dB, To correspond to the first point -20dB, to the second -18 and so on: at each point increase of 2 dB up to +20)

Akzeptierte Antwort

Star Strider
Star Strider am 11 Okt. 2021
Try something like this —
x = linspace(0, 21, 25);
y = rand(size(x));
figure
plot(x, y)
xt = get(gca, 'XTick');
xtv = linspace(min(xt), max(xt), 21);
set(gca, 'XTick',xtv, 'XTickLabel',compose('%3d dB',-20:2:20))
Make appropriate changes to get the result you want.
.

Weitere Antworten (0)

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by