Info

This question is closed. Reopen it to edit or answer.

Interpolate all data to nearest hundredth

1 view (last 30 days)
Konstantinos Belivanis
Konstantinos Belivanis on 6 Aug 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello all,
I have test data and as usual the frequency I have them is too high. In order to have a cleaner set, how can interpolate automatically all my XY values for X = 0:0.01:0.5?
My data is cyclic so the same X value might be seen many times for a test.
Thanks
  2 Comments
BB BSB
BB BSB on 6 Aug 2015
Hi,
I am not sure I fully understand your question but at a first glance I would suggest utilizing the linspace function.
All the best.
henradrie
henradrie on 6 Aug 2015
I had a similar problem a few days ago. I used the spline function. It's output was more closely spaced y values. Using the curve fitting app would work too and is easier.

Answers (1)

Walter Roberson
Walter Roberson on 6 Aug 2015
If you want to round a value to the .01's then round(value*100)/100 is as close as you can get in binary.
  3 Comments
Walter Roberson
Walter Roberson on 6 Aug 2015
>> value = [0.0543
0.0573
0.0627
0.0629
0.0678
0.071
0.0862];
>> round(value*100)/100
ans =
0.05
0.06
0.06
0.06
0.07
0.07
0.09
Walter Roberson
Walter Roberson on 6 Aug 2015
You might want to unique() the result.

Community Treasure Hunt

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

Start Hunting!