how to show points?

조회 수: 130 (최근 30일)
ker fang fang
ker fang fang 2015년 1월 19일
답변: Anju 2022년 10월 1일
hi, i have these points, (10,90),(70,90),(10,30),(70,30). how do i plot in matlab? i want the display graph to be showing those points. can anyone hep me?
the axis
axis([0 100 0 100]);
  댓글 수: 1
ker fang fang
ker fang fang 2015년 1월 19일
sorry, i got it already. but another question. once i plot thoe points. how to i scatter other random points around those points?
this the way to plot points. but how do i make other random points scatter around it?
x = [10 10 70 70];
y = [30 90 30 90];
plot(x, y, 'o');
axis([0 100 0 100]);

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

답변 (2개)

Chris Barnhart
Chris Barnhart 2015년 1월 19일
This is an answer. Not sure its what you wanted.
x = [10 10 70 70]; y = [30 90 30 90]; % make some random vectors 100x4 nrp = 100; r1=10* (rand(nrp, length(x)) - 0.5); r2=10* (rand(nrp, length(x)) - 0.5);
% extend x and y into 100x4 then add the random variable rx = repmat(x, nrp, 1) + r1; ry = repmat(y, nrp, 1) + r2;
plot(x, y, 'o', rx, ry,'.');
Here the random points fill a square block around the points. If you want a circular region, generate a random r and a random angle, then convert to x and y. If you want a density to drop off, thats a bit more difficult.

Anju
Anju 2022년 10월 1일
v= [1:1:10]
t= [11:1:20]
plot(v, t)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by