loglog2.m (1262B)
1 function []=loglog2(x,y,sym,xax,yax); 2 % function []=loglog2(x,y,sym,axlabel); 3 % 4 % Plots y vs x with both on a log10 scale 5 % 6 % sym is a symbols argument: if a string, then just pass it 7 % along to plot. If a vector, then use as plotname. 8 % 9 % xax is the string to use to label the x axis (passed to strmat) 10 % yax is the string to use to label the y axis. 11 12 if length(sym)==1; 13 loglog(x,y,sym); 14 else; 15 disp 'error not implemented for data labels'; 16 loglog(x,log(y),sym); 17 end; 18 19 % Now fix the log scale for the y axis. 20 %val=[1000 2000 4000 8000 16000 32000]'; 21 %labs=strmat('1000 2000 4000 8000 16000 32000'); 22 if exist('yax')~=1; 23 curlabs=get(gca,'YTickLabels'); 24 newnum=10.^(str2num(curlabs)); 25 newlabs=num2str(newnum,'%6.0f'); 26 set(gca,'YTickLabels',newlabs); 27 set(gca,'YTick',str2num(curlabs)); 28 else; 29 labs=strmat(yax); 30 logval=log10(str2num(yax)); 31 set(gca,'YTick',logval); 32 set(gca,'YTickLabels',labs); 33 end; 34 35 if exist('xax')~=1; 36 curlabs=get(gca,'XTickLabels'); 37 newnum=10.^(str2num(curlabs)); 38 newlabs=num2str(newnum,'%6.0f'); 39 set(gca,'XTickLabels',newlabs); 40 set(gca,'XTick',str2num(curlabs)); 41 else; 42 labs=strmat(xax); 43 logval=log10(str2num(xax)); 44 set(gca,'XTick',logval); 45 set(gca,'XTickLabels',labs); 46 end;