필터 지우기
필터 지우기

how can I center my data

조회 수: 8 (최근 30일)
Noob
Noob 2017년 6월 13일
편집: Noob 2017년 6월 19일
I would like to draw an ellipse, and then center my data points on these ellipses.

채택된 답변

KSSV
KSSV 2017년 6월 13일
data = rand(100,2) ;
plot(data(:,1),data(:,2),'.r') ;
%%draw ellipse
x = data(:,1) ; y = data(:,2) ;
x0 = min(x) ; x1 = max(x) ;
y0 = min(y) ; y1 = max(y) ;
a=abs(x1-x0) ; % horizontal radius
b=abs(y1-y0); % vertical radius
% x0,y0 ellipse centre coordinates
x0=mean(x);
y0=mean(y);
t=-pi:0.01:pi;
xe=x0+a*cos(t);
ye=y0+b*sin(t);
hold on
plot(xe,ye,'b')

추가 답변 (0개)

카테고리

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