Error trying to plot circle

조회 수: 4 (최근 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 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