Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I don't know why I am not getting an arc when I change the dimension

1 回表示 (過去 30 日間)
Amal Fennich
Amal Fennich 2020 年 3 月 18 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
circx= linspace(30,70,50);
circy= sqrt(8.35^2 - (circx-.5).^2)-8.335;
plot(circx, circy) % Draw An Arc
axis([0 100 -30 30]) % Set Axis Limits
  1 件のコメント
Geoff Hayes
Geoff Hayes 2020 年 3 月 18 日
Amal - which dimension have you changed? Perhaps the problem is with circy which has imaginary numbers....

回答 (1 件)

Jon
Jon 2020 年 3 月 18 日
編集済み: Jon 2020 年 3 月 18 日
I'm not sure from your code exactly what the parameters of your arc should be but this is probably closer to what you want. You can probably modify from here if it is not exactly what you intended
% define circle center and radius
x0 = 0.5
y0 = 8.35
r = 8.35
% define circle with origin at circle center
circx= linspace(0,r,50);
circy = sqrt(r^2 - circx.^2);
% shift to origin at 0,0
x = x0 + circx
y = y0 + circy
plot(x, y) % Draw An Arc
axis([0 100 -30 30]) % Set Axis Limits
  1 件のコメント
Jon
Jon 2020 年 3 月 18 日
編集済み: Jon 2020 年 3 月 18 日
I would suggest however that it would be much simpler to do this in polar coordinates for example something like this. Also maybe even more directly you could use polarplot, but that might limit you to having arcs centered on the origin
% define circle center and radius
x0 = 0.5
y0 = 8.35
r = 50
% define start and end angle of arc in deg
thetaRange = [10 80]
% define points along arc
theta = linspace(thetaRange(1),thetaRange(2),50)% points along arc
% assign x and y coordinate values
x = r*cosd(theta) + x0;
y = r*sind(theta) + y0;
plot(x, y) % Draw An Arc
axis([0 100 -30 30]) % Set Axis Limits

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by