MATLAB: Changing horizontal x axis from 0-1-0 plotting Hi. How to change the order of x axis in the plot function? Instead of 1 , 2 , 3… i would the axis to plot for 0.2, 0.4,…,0.9 , 1, 0.9,…,0.4, 0.2. ? Thank a lot. Best Answer %-----Example---------t=0:0.1:20y=sin(t);plot(t,y)%-------------------------xl=get(gca,'xlim')xti=[0.2:0.1:1 0.9:-0.1:0.2]set(gca,'xtick',linspace(xl(1),xl(2),numel(xti)))xti1=arrayfun(@num2str,xti,'un',0)set(gca,'xticklabel',xti1) Related SolutionsMATLAB: Plotting graph with variables on x axis Something like this:y = randn(123,1);x = linspace(0,1,123);plot(x,y)xtstr = {'0','0.2d','0.4d','0.6d','0.8d','1d'};set(gca,'xtick',0:0.2.1,'xticklabel',xtstr)HTH MATLAB: Approximate plot for values of 0-10 I guess you need to change the meshgrid()[X,Y] = meshgrid(0:10);I guess that's all! Related QuestionMatrices Dimensions Not Consistent when t=0:10Figure axis: How to change ‘0 1 2 3’ into ‘0.0 1.0 2.0 3.0’ while keeping ‘ x 10^9’ on the top of y axisChange the axis tickHow to scale the Tick Label by a number
Best Answer