how can i plot a simple circle having radius 8000???

2 ビュー (過去 30 日間)
mohini ramwala
mohini ramwala 2014 年 11 月 1 日
回答済み: Image Analyst 2014 年 11 月 1 日
i want to construct a circle centered at ORIGIN havin radius 8000. I tried the code given in examples but it says that 'function definations are not permitted in this context'.So now what should i do???
  1 件のコメント
Geoff Hayes
Geoff Hayes 2014 年 11 月 1 日
Mohini - in the future, if you are observing errors with your code, then post the code as well so that we can provide some guidance as to what to do to correct the problems (and/or reference the examples).

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

採用された回答

Geoff Hayes
Geoff Hayes 2014 年 11 月 1 日
編集済み: Geoff Hayes 2014 年 11 月 1 日
Mohini - there are a number of circle drawing functions on the File Exchange so you could find something there.
Else, you can use the rectangle function to draw your circle. Since you want the circle centred at the origin (0,0) and have a radius of 8000, then try the following
rectangle('Position',[-8000 -8000 16000 16000],'Curvature',[1 1]);
axis equal
Or, more generally,
radius = 8000;
originX = 0;
originY = 0;
rectangle('Position',[originX-radius originY-radius 2*radius 2*radius], ...
'Curvature',[1 1]);
axis equal

その他の回答 (2 件)

Jan
Jan 2014 年 11 月 1 日
The meaning of a "radius of 8000" is not clear, because you forgot to define the units. It matters, if you mean "data"-Units, such that the X-Tick labels are set to -8000 to 8000, of if you want it to be in cm or pixels.
The error message means, that you tried to insert the definition of a function in the command window or in a script. Functions can be defined in function files only, and such a function file can be recognized by the fact, that it starts with the term "function".
You can find a lot of corresponding threads in the forum, when you take the time to search for (a part of) the error message. It is recommended to search in a forum before asking a new -better: old- question.
  2 件のコメント
mohini ramwala
mohini ramwala 2014 年 11 月 1 日
Thank you sir for your response . As i am using matlab for the first time ,i dont know much about it!I typed your suggested code in matlab but it says that 'axis equal' is unexpected matlab operator!
mohini ramwala
mohini ramwala 2014 年 11 月 1 日
sorry sir!! Got my mistake..and thank you so much for your help!

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


Image Analyst
Image Analyst 2014 年 11 月 1 日
It's worth checking the FAQ http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F There is code in there to make circles and ellipses.

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by