Help creating an ellipse

3 visualizaciones (últimos 30 días)
Jeffrey
Jeffrey el 13 de Oct. de 2014
Comentada: Image Analyst el 13 de Oct. de 2014
This is my function file:
function ellipseplot(xc,yc,a,b) ((xc^2))/((a^2))+((yc^2))/((b^2)); end
And this is my script file where I call the function:
fplot('ellipseplot(3.5,2.0,8.5,3)',[-20,20]) figure(1)
However, whenever I execute the script file, it throws up a bunch of errors. What am I doing wrong? Thanks.
  1 comentario
Jeffrey
Jeffrey el 13 de Oct. de 2014
The errors are as follows:
Error using inlineeval (line 14) Error in inline expression ==> ellipseplot(3.5,2.0,8.5,3) Too many output arguments. Error in inline/feval (line 33) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in fplot (line 101) x = xmin; y = feval(fun,x,args{4:end}); Error in Functions_1_HW (line 24) fplot('ellipseplot(3.5,2.0,8.5,3)',[-20,20])

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 13 de Oct. de 2014
  3 comentarios
Jeffrey
Jeffrey el 13 de Oct. de 2014
I'm looking to fix my function so that, when I call it, it will work properly.
Image Analyst
Image Analyst el 13 de Oct. de 2014
Your function does not return anything whatsoever. Nothing. Moreover, it doesn't even do any plots inside of it. It's merely an expression that gets evaluated - that's all. It doesn't get assigned to anything and even if it did, it's not returning anything. Yes, if you follow the FAQ you can get working code.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by