“Function with duplicate name cannot be defined” error but no duplicate function

When you create a MATLAB function, each function should be in a separate file and the name of each file should be identical to the name of the function. If however you have a main file, and you want some local function, you can write the local function in the same file, but only the main function will have access to it. In your case computeDerivative is the main function and gradientDescent is the local function

Leave a Comment