Undefined function for input arguments of type 'double'
306 views (last 30 days)
I have this set of data
y=4- 3*x + sin(x*6*pi) + rand(1,101)/8;
and want to do a fit using fminsearch
b=fminsearch(@(b) doamne(b,x,y), b0);
yfit= b(1)+ b(2)*x + b(3)*sin(x*pi*b(4));
c2=y- (b(1)+ b(2)*x)
but I keep getting this error: "Undefined function 'doamne' for input arguments of type 'double'." I double checked that all my files are in the working folder and that the working folder is in the path list but the error persists.
Geoff Hayes on 10 Nov 2014
Stefania - in the Command Window, type
which doamne -all
to find the path to your doamne function. Perhaps you have named the m file for this function incorrectly, and so it cannot be found.
I was able to take the doamne function and copy and paste its code into a file named doamne.m and then could run the remainder of your code without error.
More Answers (1)
Jithin Nambiar J on 10 Apr 2021
It sometimes gives you this error if you don't have the right toolboxes installed for the certain function.
If a particular function is causing an error. Try typing
If this results in like a certain toolbox is required for this function to work. Just click on the hyperlink or underlined link which is given in the terminal.
It will direct you to the appropriate package. Make sure you save any programs. Since installing the packages requires MATLAB to restart.