How to plot a circle with radius and coordinates?

Hey guys.. I'm new in Matlab and this is my first week of using it, and our teacher already gave us homeworks. He didn't show us anything, just something about matrix.
Please, how can I plot center(5,7) and radius 3? I've tried this:
function circleplot(xc, yc, r)
t = 0 : .1 : 2*pi;
x = r * cos(t) + xc;
y = r * sin(t) + yc;
plot(x, y)
axis square; grid
and called it like this:
xc = 5;
yc = 7;
r = 3;
circleplot(xc, yc, r)
Gives me error: | Undefined function 'circleplot' for input arguments of type 'double'. |

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 15 de Mzo. de 2014

0 votos

Your code is correct, check if your function is saved in the current folder

4 comentarios

Manu Manu
Manu Manu el 15 de Mzo. de 2014
Where to check that? I searched in all folders for 'functions'. Or is it about the program saving? I saved the program in Documents/Matlab. But I think it's ok.
type
dir circleplot.m
Manu Manu
Manu Manu el 16 de Mzo. de 2014
Man I forgot that my teacher wanted a SCRIPT to make this. What is the code for script?
The same without
function circleplot(xc, yc, r)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 15 de Mzo. de 2014

Comentada:

el 16 de Mzo. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by