Help creating an ellipse

3 Ansichten (letzte 30 Tage)
Jeffrey
Jeffrey am 13 Okt. 2014
Kommentiert: Image Analyst am 13 Okt. 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 Kommentar
Jeffrey
Jeffrey am 13 Okt. 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])

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 13 Okt. 2014
  3 Kommentare
Jeffrey
Jeffrey am 13 Okt. 2014
I'm looking to fix my function so that, when I call it, it will work properly.
Image Analyst
Image Analyst am 13 Okt. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by