I want to draw an ellipse.

조회 수: 1 (최근 30일)
Muhendisleksi
Muhendisleksi 2017년 10월 8일
댓글: KSSV 2017년 10월 9일
a = [3,43297558626052
3,87411756739963
3,48864274576452
5,73273061981691];
b = [2,28896810981967
3,12258785934561
2,33941014244949
4,83050996666401];
tetha =[39,0479375074525
372,239032928828
164,091747332544
232,681387669483]
x0 = 0;
y0 = 0;
for i =length(a)
t = -tetha(i):0.01:tetha(i);
x(i,1) = xo + a(i)*cos(t) %there is an error here.
y(i,1) = yo + b(i)*sin(t)
plot(x(i),y(i))
end

채택된 답변

KSSV
KSSV 2017년 10월 9일
a = [3,43297558626052
3,87411756739963
3,48864274576452
5,73273061981691];
b = [2,28896810981967
3,12258785934561
2,33941014244949
4,83050996666401];
tetha =[39,0479375074525
372,239032928828
164,091747332544
232,681387669483] ;
x0 = 0;
y0 = 0;
X = cell(length(a),1) ;
Y = cell(length(a),1) ;
figure
hold on
for i =1:length(a)
t = -tetha(i):0.01:tetha(i);
X{i} = x0 + a(i)*cos(t) ; %there is an error here.
Y{i} = y0 + b(i)*sin(t) ;
plot(X{i},Y{i})
end
  댓글 수: 3
Muhendisleksi
Muhendisleksi 2017년 10월 9일
A = [2.026619126924945];
B = [0.859242349038952];
xo = 0;
yo = 0;
figure
hold on
for i =1:length(a)
t = -tetha(i):0.01:tetha(i);
x = xo + A(i)*cos(t);
y = yo + B(i)*sin(t);
plot(x,y,'r')
end
a = [3,43297558626052
3,87411756739963
3,48864274576452
5,73273061981691];
b = [2,28896810981967
3,12258785934561
2,33941014244949
4,83050996666401];
tetha =[39,0479375074525
372,239032928828
164,091747332544
232,681387669483] ;
x0 = 0;
y0 = 0;
X = cell(length(a),1) ;
Y = cell(length(a),1) ;
figure
hold on
for i =1:length(a)
t = -tetha(i):0.01:tetha(i);
X{i} = x0 + a(i)*cos(t) ; %there is an error here.
Y{i} = y0 + b(i)*sin(t) ;
plot(X{i},Y{i})
end
%can we show two elipside in the same window?
KSSV
KSSV 2017년 10월 9일
Use hold on...

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by