Interpolation of data using interp1
Show older comments
I have a data in CSV file and I am working on a code to plot Time vs Amp., the problem is the data doesn't have a constant interval, sometimes one point is 3 ms from the other, which is 5 ms from the next one, so I used interp1 function to interpolate the data with a difference of 1ms, but I am not sure if it is correct, I've never used this function before, so I would like to know if what I did is correct.
maxtime1 = max(Timeconverted1);
TimestampNum1 = 0:1:maxtime1;
amp1 = interp1(Timeconverted1,ampcorrected1,TimestampNum1);
Timeconverted1 is the original time data (in ms), but with no constant interval. Amp1corrected1 is the amplitude data. I want a variable (amp1) to have values for each second, so I can plot(TimestampNum1, amp1).
Thank you in advance.
1 Comment
Azzi Abdelmalek
on 23 Jul 2015
You can try it and see if it's correct or not.
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!