필터 지우기
필터 지우기

How to make matlab draw lines?

조회 수: 1 (최근 30일)
Gemalyn Apostol
Gemalyn Apostol 2016년 10월 27일
답변: Image Analyst 2016년 10월 27일
How to make matlab draw lines between points (1,1) and (2,0); (3,1) and (2,4); and (2,2) and (3,4)?
I try this code but it didn't work.
x= [ 1 3 2; 2 2 3 ]
y= [ 1 1 2; 0 4 4 ]
plot (x,y)

답변 (2개)

KSSV
KSSV 2016년 10월 27일
x = [ 1 3 2 2 2 3 ] ;
y= [ 1 1 2 0 4 4 ] ;
plot(x,y)
  댓글 수: 1
Walter Roberson
Walter Roberson 2016년 10월 27일
No, that would draw one line. The user wants to draw a series of short lines.

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


Image Analyst
Image Analyst 2016년 10월 27일
Try this:
x= [ 1 3 2; 2 2 3 ]
y= [ 1 1 2; 0 4 4 ]
for col = 1 : size(x, 2)
line(x(:, col), y(:, col), 'LineWidth', 3, 'Color', 'r');
end
grid on;
xlim([0, 4]);
ylim([0, 5]);

카테고리

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