필터 지우기
필터 지우기

How can I plot a reverse x-axis on the same graph?

조회 수: 3 (최근 30일)
Jeah MK
Jeah MK 2022년 1월 26일
편집: KALYAN ACHARJYA 2022년 1월 26일
I have x = [0 1 2 3 4 3 2 1 0]; and y = 2*x; how can I plot(x,y) and see the value on x-axis as [0 1 2 3 4 3 2 1 0]?

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2022년 1월 26일
편집: KALYAN ACHARJYA 2022년 1월 26일
#Convert to strings
x=[0 1 2 3 4 3 2 1 0];
y = 2*x;
plot(y);
data=string(x);
set(gca,'xtick',1:length(x),'xticklabel',data)

추가 답변 (0개)

카테고리

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