I want to draw an ellipse.

3 visualizzazioni (ultimi 30 giorni)
Muhendisleksi
Muhendisleksi il 8 Ott 2017
Commentato: KSSV il 9 Ott 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

Risposta accettata

KSSV
KSSV il 9 Ott 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 Commenti
Muhendisleksi
Muhendisleksi il 9 Ott 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 il 9 Ott 2017
Use hold on...

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by