How to plot a continuous graph on X-Y plane which follows pattern like
x=0:1:10; y=0;
plot (x,y);
hold on;
then y=0.1; x=10:-1:0;
plot (x,y);
hold on;
.
.
.
.
.
upto y=10; x=10; % the plot should look like a snake

댓글 수: 2

KSSV
KSSV 2019년 3월 18일
How about using sin?
Harry S
Harry S 2019년 3월 18일
편집: Harry S 2019년 3월 18일
I want my plot to be in this manner with equal spacing

댓글을 달려면 로그인하십시오.

 채택된 답변

KSSV
KSSV 2019년 3월 18일

1 개 추천

Play around with this:
x = 1:100 ;
y = 1:100 ;
ind1 = reshape(y,5,[])' ;
y(ind1(1:2:end,:)) = -0.5 ;
y(ind1(2:2:end,:)) = 0.5 ;
plot(y,x)
xlim([-1 1])

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2019년 3월 18일

편집:

2019년 3월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by