Error: Not enough input arguments (using function fminsearch)
Mostrar comentarios más antiguos
Hi guys, I'm quite new to Matlab and quite clueless.
I am trying to optimize parameters by comparing experimental data to numerical coding (stress-stretch diagrams) but am getting errors of the type not enough input arguments. I'll attach the codes and give an explanation.
- Optimiere.m is the code I am using to find the optimized parameters. When I try to run it, it gives error: Not enough input arguments.
- Berechne_fehler.m is the code that calculates the error between the numerical and experimental data. Specimen6mm.dat is the data file that has the experimental data points necessary for the calculations. I haven't attached it here because the file is too big. When I try to run the code, it gives error: Not enough input arguments.
- mainDER.m is the code being called in berechne_fehler.m, necessary for the calculation of the numerical stress data.
I don't know how clear I've been. I would really appreciate some pointers.
Thanks :)
Respuestas (1)
The error message tells us that your function requires some arguments, but that you are not providing these arguments when you call the function. You are calling the function like this:
berechne_fehler
but it requires the input argument para to be defined, which means you need to call it like this:
berechne_fehler(input_variable)
Likewise for the other function optimiere. Note that this kind of basic MATLAB usage is covered in these tutorials, which you should work through to learn how to use basic MATLAB functionality:
Also I would suggest a different approach to coding using fminsearch: start with a working example (taken from the documentation), and then alter it step-by-step to suit your task. Test each step as you change it. This is easier and more reliable than writing a huge amount of code, just to find that it does not work properly.
1 comentario
jgg
el 10 de En. de 2016
In particular, I notice that you call the data loading within the function to be optimized. This is likely going to be very slow; you'll have to load the data thousands of times. Instead, try calling it outside then passing the data in instead.
Categorías
Más información sobre Solver Outputs and Iterative Display en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!