MATLAB Answers


How to fix this error: "Undefined function 'ellipsoiddrag' for input arguments of type 'double'."

Asked by Eric
on 17 May 2013

Function 'ellipsoiddrag' calculates the aerodynamic drag of an ellipsoid. The error message appeared out of the blue when I tried to execute the function. When I tried to execute another function which had worked two days ago, I got the same error. What have I done and how do I fix it?



No products are associated with this question.

1 Answer

Answer by James Tursa
on 17 May 2013
 Accepted answer

Check that the functions are in a directory that is on the MATLAB path, or that the functions are in the current directory. It could be that two days ago the current directory happened to be the directory with the functions in it (which is why they worked) but today your current directory was something else (which is why they weren't found).


on 20 May 2013

Dear Mr. Tursa,

Your suggestion was spot on. I had created a subdirectory for functions like ellipsoiddrag.m, but had forgotten to put it on the path. Thank you.

However, I would like to point out that the error message "Undefined function 'ellipsoiddrag' for input arguments of type 'double' is ambiguous. Does it mean that the function is undefined "for" certain input arguments? You correctly interpreted it as an "undefined function." In other words, the error had nothing to do with the input arguments. (I had another person confirm this; he, too, was misled.) I suggest that the error message simply say "undefined function." Or even better, "Can't find function [name]; not in any directory on the path."

MATLAB uses method resolution based upon the datatype of the first argument (usually!) so you could, for example, have a defined method named ellipsoiddrag that was in the uint16 namespace but was not in the double namespace. You need both pieces of information, the name and the datatype, to properly investigate missing functions.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!