Matlab在绘图上没有显示足够的数字

时间:2014-01-25 15:07:36

标签: matlab plot axis digit

我想在MATLAB中绘制图形,但它显示x轴为x10 ^ 6! 如何让它显示10 000 000?见下图。

enter image description here

    frequency=[9999445,9999475,9999500,9999517,9999543,9999562,9999580,9999604,9999626,9999647,9999668,9999688,9999705,9999730,9999755,9999780,9999800,9999830,9999847,9999862,9999883,9999900,9999920,9999930,9999950,9999985,9999994,10000000,10000010,10000018,10000026,10000032,10000039,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045,10000045];
 temperature=[283,293,299,303,306,309,312,315,318,320,323,326,328,330,333,336,338,342,343,345,348,350,352,353,353,357,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354];
 time=[1:10:540]


 %plot(frequency)
 %figure,plot(temperature)

 figure,plot(frequency,temperature);

1 个答案:

答案 0 :(得分:2)

您可以在当前轴的 XTickLabel 属性中使用设置功能。

一个例子是:

x=[999 1000 1001 1002 1003];
y=3*x;
plot(x,y);
set(gca, 'XTick', x, 'XTickLabel', sprintf('%4.0f|', x));

enter image description here

在你的情况下,你可以这样做:

x=linspace(min(frequency),max(frequency),5);
figure,plot(frequency,temperature);
set(gca, 'XTick', x, 'XTickLabel', sprintf('%7.0f|', x));

enter image description here

您可以更改5值以获得更多或更少的刻度。