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

1 次查看(过去 30 天)
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

回答(1 个)

Prajit T R
Prajit T R 2018-3-20
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

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by