MATLAB: Plotting graph with variables on x axis plotting graph Hello all, I want to plot graph with my x axis as 0 to 1d with intervals 0.2 .It should look like [0,0.2d,0.4d,0.6d,0.8d,1d] What code I shoul give . Best Answer 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 Related SolutionsMATLAB: Changing horizontal x axis from 0-1-0 %-----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) MATLAB: How to convert ‘123’ to [1,2,3] For single digits like you have, subtract '0':s = '123'numbers = s - '0' Related QuestionAnimated plot with trajectory pointsWhat is the equation for this graphBasic 3D plotting on 3D axis
Best Answer