|
I think this code might be a better way:
- %made by rocwoods in matwav
- function xscalef(x,f,h)
- %x轴任意坐标尺度下的图
- %x:原始数据
- %f:y关于x的函数句柄。h:x坐标尺度相应的函数句柄;
- %例如:log尺度下,h=@(x)10.^x;
- plot(x,f(h(x)));
- set(gca,'xTicklabel',strcat(num2str(h(1)),'|',num2str(h(2)),'|',...
- num2str(h(3)),'|',num2str(h(4)),'|',num2str(h(5)),'|',num2str(h(6)),'|',...<br>num2str(h(7)),'|',num2str(h(8))));
- axis([1 8 0 h(9)]);
复制代码
================================================
- h=@(x)5*2.^x;
- f=@(x)x;
- xscalef(1:0.1:1000,f,h);
复制代码
|
|