Error trying to plot circle

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 2-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