MATLAB Answers

Plotting graph with variables on x axis

33 views (last 30 days)
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 .

  0 Comments

Sign in to comment.

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 17 Oct 2019
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

  1 Comment

Sign in to comment.

More Answers (0)

Sign in to answer this question.