I’m looking at some Matlab code (don’t have the software). I’m wondering what the following does:
d=[0 diff(fM)]
where fM is itself an array.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Help documentation for
diffin Octave (I suppouse Matlab equivalent works the same as with any other Matlab/octave functions)So basically,
diffreturns a vector withn - 1entries, the code posted is creating a new array adding a zero at the beginning so the new diff vector remain the same size as the input vector (maybe the resulting vector is going to be used in another routine that assumes the input vector length for calculations, it’s difficult without the rest of the code), hope it helps