How can i create a function that returns the x and y coordinate of a circle with given center, radius an interval from 0 to 2*pi?

5 ビュー (過去 30 日間)
How can i create a function that returns the x and y coordinate of a circle with given center, radius an interval from 0 to 2*pi?
  5 件のコメント
Özgür Saglam
Özgür Saglam 2020 年 5 月 3 日
Yeah i know the linspace function but i dont know how i should integrate it in my function
Rik
Rik 2020 年 5 月 3 日
Look at how you are generating the t vector. That would be a way to make your circle look a lot more like a circle.

サインインしてコメントする。

回答 (1 件)

Maadhav Akula
Maadhav Akula 2020 年 5 月 6 日
Hi,
According to your comments I think you just want a particular point (x,y co-ordinates) on a circle. For that you should also pass the angle value too. You got the function almost right, I have modified it a little:
function [x,y] = getCircle(xm,ym,radius,t)
x = radius*cos(t)+xm;
y = radius*sin(t)+ym;
end
where t can lie between the interval [0,2*pi] in radians.
Hope this helps!
  2 件のコメント
Rik
Rik 2020 年 5 月 6 日
Personally I think it is more likely that OP was calling the function with a single output and should increase the number of angles.
It looks like homework to me, and I don't see how it makes sense to ask for a part of the arc in a homework question.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by