Borrar filtros
Borrar filtros

Error using inline. Input must be a string.

6 visualizaciones (últimos 30 días)
Roberto Antonino Ruggeri
Roberto Antonino Ruggeri el 11 de Feb. de 2016
Editada: Roberto Antonino Ruggeri el 13 de Feb. de 2016
Hi Everyone. I'm studying the steepest descend method and I have tried to compile this method for a function. The problem is that when I compile, the command window shows "Error using inline (line 51)Input must be a string." and I don't know what to do.
  1 comentario
Stephen23
Stephen23 el 11 de Feb. de 2016
Editada: Stephen23 el 11 de Feb. de 2016
Inline functions are basically obsolete... you should be using function handles!

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Feb. de 2016
syms X
fprime = matlabFunction( diff(exp(-X)+X.^4', X) );
If you do not have the symbolic toolbox then diff() is entirely the wrong function to use, as diff() on a non-symbolic object X is X(2:end,:) - X(1:end-1,:) -- that is, numeric difference between adjacent elements.
If you do not have the symbolic toolbox then
fprime = @(X) -exp(-X) + 4.*X.^3;
would be the formula.
  1 comentario
Roberto Antonino Ruggeri
Roberto Antonino Ruggeri el 11 de Feb. de 2016
Oh thank you so much Walter!!! Now it works!! Thank you!!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by