Error: "Difference order N must be a positive integer scalar" when called symbolic gradient function
Afficher commentaires plus anciens
In my program, I first use command jacobian generate a symbolic gradient of my objective function.Then I call the function(gradient.m) and feed it with numeric value. But Matlab warned me like
Warning: Function "diff" is not verified to be a valid MATLAB
function.
Warning: Function "diff" is not verified to be a valid
MATLAB function.
Warning: Function "diff" is not verified to be a valid
MATLAB function.
Error using diff
Difference order N must be a positive integer scalar.
Error in gradient (line 10)
t4 = diff(t2,B1);
Error in mini_dist_noheter (line 60)
dfb = gradient(b(1),b(2),b(3));
The gradient function file, main file and data see the attachment.
2 commentaires
The error message seems quite clear.
In your command
t4 = diff(t2,B1)
B1 is not a positive integer.
Best wishes
Torsten.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!