Help creating an ellipse

조회 수: 3 (최근 30일)
Jeffrey
Jeffrey 2014년 10월 13일
댓글: Image Analyst 2014년 10월 13일
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
Jeffrey
Jeffrey 2014년 10월 13일
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])

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2014년 10월 13일
  댓글 수: 3
Jeffrey
Jeffrey 2014년 10월 13일
I'm looking to fix my function so that, when I call it, it will work properly.
Image Analyst
Image Analyst 2014년 10월 13일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by