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 (최근 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에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by