fsolve will not work on my machine
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have been trying to get fsolve to work on my personal computer. I have tried many different problems and all come out with the same error. "Error using fsolve. Too many input arguments." I have ultimately dumbed down my problem to solve to the code at the end to make sure it isn't a coding error. This code works perfectly on the school's computer but not on my own. I have checked and I do have the optimization toolbox installed. Other functions in the optimization toolbox work, such as fmincon. I have tried uninstalling and reinstalling the optimization toolbox. I have also uninstalled and reinstalled matlab. I am using version 2018b but have also tried using 2017b on my personal computer but neither work. Is there something that I am missing. This is a fairly straight forward function.
Thanks for your help.
clc;
x0=0;
x=fsolve(@test,x0);
function F=test(x)
F=2*x+1;
end
4 comentarios
Justin Becker
el 3 de Abr. de 2019
Editada: Justin Becker
el 3 de Abr. de 2019
Respuestas (1)
KALYAN ACHARJYA
el 4 de Abr. de 2019
Editada: KALYAN ACHARJYA
el 4 de Abr. de 2019
Do the following;
- Save the function named as test.m
function F=test(x)
F=2*x+1;
end
2. Call the function from different main script or command window
clc;
x0=0;
x=fsolve(@(x) test(x),x0);
There may be same function name conflict, so change the function name in all three position.
- Change function name
- Change in save Matlab file name
- During Call the function name
All must be tthe same name.
Or
As @Adam suggested to avoid the conflict the file name with inbuilt function (fsolve)

Hope it Helps!
0 comentarios
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!