Error trying to plot circle

2 ビュー (過去 30 日間)
Jenny Andersen
Jenny Andersen 2019 年 12 月 5 日
回答済み: Star Strider 2019 年 12 月 5 日
Hi I am trying to plot a circle but I alsways get the same error "
Error in circle (line 11) a = r.*cos(v)+j;
Can you see why?
My script:
A = [10 8 2; 10 8 1; -2 9 1; 2 -1 1]
B = [50; 60; 26; 2]
M = A.' * A;
d = A.' * B;
x = A\B;
j = 2.3102
o = 2.8380
r = x.'
v = 0:pi/100:2*pi;
a = r.*cos(v)+j;
b = r.*sin(v)+o;
plot(a,b)

採用された回答

Star Strider
Star Strider 2019 年 12 月 5 日
You apparently want to plot three different circles with different radii.
This works:
A = [10 8 2; 10 8 1; -2 9 1; 2 -1 1]
B = [50; 60; 26; 2]
M = A.' * A;
d = A.' * B;
x = A\B;
j = 2.3102
o = 2.8380
r = x.'
v = 0:pi/100:2*pi;
a = r(:)*cos(v)+j;
b = r(:)*sin(v)+o;
figure
plot(a.',b.')
axis equal
The transpositions in the plot call are necessary. Otherwise you get a ‘starburst’ effect that while interesting, is not what you indicated that you want.

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by