Dual axis plot for the same data, left = linear -1 0 +1, right side= linear in dB -0db inf +0db
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Jonathan Broyles
am 1 Dez. 2023
Kommentiert: Mathieu NOE
am 4 Dez. 2023
Acoustic wave form plot, amplitude range -1 to 0 to +1 (left side), in dB, -0dB to inf to +0dB (right side). The right and left side would correspond to each other. Zero on the amplitude side equals infinity on the dB side. The plot displays fine except that I'm not able to get the right side to range from -0dB to inf to +0dB. Any ideas would greatly appreciated. Thank you.
2 Kommentare
Akzeptierte Antwort
Mathieu NOE
am 1 Dez. 2023
Bearbeitet: Mathieu NOE
am 4 Dez. 2023
hello
something like that ?
% dual plot (linear scale left , dB scale right)
yleft_ticks = (-1:0.1:1);
yleft_ticks_labels = num2str(yleft_ticks',3);
yright_ticks = 20*log10(abs(yleft_ticks));
yright_ticks_labels = num2str(yright_ticks',2);
% create plot with yyaxis
x = linspace(0,10);
y = 0.5*sin(x)+0.1*randn(size(x));
yyaxis left
plot(x,y)
ylim([-1 1]);
ylabel('Mag (linear)')
set(gca, 'YTick', yleft_ticks,'YTickLabel', yleft_ticks_labels );
yyaxis right
plot(0,0)
ylim([-1 1]);
ylabel('Mag (dB)')
set(gca, 'YTick', yleft_ticks,'YTickLabel', yright_ticks_labels );
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!