i have these plots and i want the x axis and y axis to look similar. I mean the interval needs to be same.

2 views (last 30 days)
the y axis varies with 0.05 intervals but the x axis is not the same. it is 0.1. i want y axis with o.1 interval without changing the graph

Answers (1)

Prajit T R
Prajit T R on 20 Mar 2018
Hi Pruthviraj
Try the following sample code to manually set the intervals for x and y axes as you desire.
x=0:0.1:1;
y1=-0.298*(x.^2)-0.001*x;
y2=-0.368*(x.^2)-0.001*x;
plot(x,y1)
hold on
plot(x,y2)
Min_x=0;
Max_x=1;
Min_y=-1;
Max_y=1;
xlim([Min,Max]);
set(gca,'XTick',[Min_x : 0.1 : Max_x]);
set(gca,'YTick',[Min_y : 0.1 : Max_y]);
hold off
I hope this helps.
Cheers

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!