Reputation: 375
I have written a code in matlab in which N is the vector N=[25; 50; 100; 200; 400]
The values of E are the following:
E(1)= 0.010572
E(2)= 0.002634
E(3)= 0.000658
E(4)= 0.000164
E(5)= 0.000041
I want to create a loglog graph of E and N.
To do that I wrote the following code:
axis([min(N) max(N) min(E) max(E)]);
loglog(N, E, 'red')
xlabel('N')
ylabel('E')
grid on
What can I do so that at the N-axis, there appear all the possible values of N?
Upvotes: 1
Views: 33
Reputation: 35080
Add set(gca,'xtick',N);
after your plot command.
As you can see, this will specify the xtick
s to be precisely where your N
data are. You could also add these numbers to the automatic ones: for this you should issue
ticks=get(gca,'xtick');
set(gca,'xtick',union(ticks,N));
Upvotes: 3