I want to draw an ellipse.

1 view (last 30 days)
Muhendisleksi
Muhendisleksi on 8 Oct 2017
Commented: KSSV on 9 Oct 2017
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

Accepted Answer

KSSV
KSSV on 9 Oct 2017
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 Comments
Muhendisleksi
Muhendisleksi on 9 Oct 2017
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 on 9 Oct 2017
Use hold on...

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!