I want to draw an ellipse.

1 visualización (últimos 30 días)
Muhendisleksi
Muhendisleksi el 8 de Oct. de 2017
Comentada: KSSV el 9 de Oct. de 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

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by