plot - Axis Appearance, matlab -
i trying plot cos(x) , sin(x) in graph. here code:
t = -pi:0.01:(pi); x = cos(t); y = sin(t); plot(t,x,'b'); hold on; plot(t,y,'r'); axis([-pi pi -1 1]) legend('cos(t)','sin(t)','location','northwest') title('plot of cos(x) , sin(x) between -2\pi , 2\pi')
i want alter numbers on y-axis have -pi, -pi/2, 0 ,pi pi help?
you want:
set(gca,'xtick',-pi:pi/2:pi) set(gca,'xticklabels',{'-\pi','-\pi/2','0','\pi/2','\pi'})
matlab plot
No comments:
Post a Comment