我想在 MATLAB 中绘制图形,但它显示 x Axis 为 x10^6 ! 我怎样才能让它显示 10 000 000 ?参见下图。
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);
最佳答案
您可以对当前 Axis 的XTickLabel属性使用set函数。
一个例子是这样的:
x=[999 1000 1001 1002 1003];
y=3*x;
plot(x,y);
set(gca, 'XTick', x, 'XTickLabel', sprintf('%4.0f|', x));
根据您的情况,您可以这样做:
x=linspace(min(frequency),max(frequency),5);
figure,plot(frequency,temperature);
set(gca, 'XTick', x, 'XTickLabel', sprintf('%7.0f|', x));
您可以更改 5 值以增加或减少刻度。
关于Matlab 在绘图上没有显示足够的数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21352223/