MATLAB gradient derivative troubleshooting I have an array $A$ having the next 145 values

I would like to calculate the $\frac{dA}{dX}$, having a 1D grid, $x$: 1:286:41468 

I use the function gradient:

DA_DX = gradient(A, 41468/145)


I am trying to understand why the $\frac{dA}{dX}$ output graph has peaks which cause problems to my code. Please, do you see something wrong in my steps? Is any other way to calculate the $\frac{dA}{dX}$ without gradient function?
You can calculate the derivative using the diff function and then dividing by the time interval between the "samples" in your vector like this:

dA = diff(A) / 286


The diff() function calculates the difference between an element and the previous one in the vector. With this you'll be calculating the derivative for each element in the vector as the increment in A divided by the increment in x. Check out the help for the diff() for more info.