Error using interp1>re​shapeAndSo​rtXandV (line 424) X and V must be of the same length.

41 views (last 30 days)
I geht this error message when I try to derive my acceleration of the car. I think there is a size problem, but I don't know how to solve it.
The data is measured from a car.

Accepted Answer

Stephen23 on 9 Oct 2019
Edited: Stephen23 on 9 Oct 2019
Assuming that and meas.acc.time are vectors with the same number of elements, then diff on the data vector will return a numeric vector with one element fewer than the time vector, so and meas.jerk.time will likely have mismatching sizes.
One easy solution is to take the time as the mean of adjacent time points, e.g.:
meas.jerk.time = (meas.acc.time(1:end-1) + meas.acc.time(2:end)) ./ 2;

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!