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 Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by