Interpolation of data using interp1
显示 更早的评论
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 个评论
Azzi Abdelmalek
2015-7-23
You can try it and see if it's correct or not.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!