Matlab:如何获得正确的yticklabel

时间:2015-09-04 15:18:22

标签: matlab

我使用半文字绘制了三个列向量作为SNR的函数。我想将Y-ticklabel保持在0.1,1,5。有人可以帮助我吗?

我的尝试:

SNR = [50 100 200 400];
RMS_SKL_Conv        = [2.6784   1.6988  1.1549  0.8807];
RMS_SKL_Spatial     = [0.9058   0.619   0.4886  0.4432];
RMS_SKL_Spatial_FAEC= [0.2184   0.1325  0.1197  0.1281];

figure(2);
semilogy(SNR, RMS_SKL_Conv, '*-r', SNR, RMS_SKL_Spatial, '*-b', SNR, RMS_SKL_Spatial_FAEC, 'o-k', 'LineWidth', 3, 'MarkerSize', 15);
legend({'Conventional W/O FAE Correction','Spatial W/O FAE Correction', 'Spatial with FAE Correction'},'FontSize', 20, 'FontName', 'Times new roman', 'FontWeight','bold');
set(gca,'YTickMode','manual')
set(gca,'ytick',[10^-1 10^0 4])

另外,我注意到 ticklabel 会因重新调整大小而改变。有人可以解释一下如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

SNR = [50 100 200 400];
RMS_SKL_Conv        = [2.6784   1.6988  1.1549  0.8807];
RMS_SKL_Spatial     = [0.9058   0.619   0.4886  0.4432];
RMS_SKL_Spatial_FAEC= [0.2184   0.1325  0.1197  0.1281];

figure(2);
semilogy(SNR, RMS_SKL_Conv, '*-r', SNR, RMS_SKL_Spatial, '*-b', SNR, RMS_SKL_Spatial_FAEC, 'o-k', 'LineWidth', 3, 'MarkerSize', 15);
legend({'Conventional W/O FAE Correction','Spatial W/O FAE Correction', 'Spatial with FAE Correction'},'FontSize', 20, 'FontName', 'Times new roman', 'FontWeight','bold');


ylim([0 5])
set(gca,'YTick',[0.2  1 5])