Increase the interpolation increment

Hi,
I have data sets as .csv with x and y coordinates. The data are correct and I plot them. However, I need to increase the X increment since the data are too much to be read by a machine. Does anybody know how can I increase the increment? Now, the X increment is 0.01 (inorganized, less or more) I need to plot the same thing with less number of points without reduce the accuracy too much. increment of let's say 0.5. What should I do?
Thanks

 Respuesta aceptada

darova
darova el 31 de Ag. de 2019
If you want to read every 5th point:
i = 1:5:length(x);
plot(x(i),y(i))

5 comentarios

Torkan
Torkan el 31 de Ag. de 2019
Thanks Darova,
However, I just do not want to read every five point. I need to interpolate those data again with an increment of 0.5.
For example, consider we have a function y=x^2. we have 20 points with increment 1 between -10 to 10. Now, I want to increase this increment to 3 for example.
What about spline or interpolation?
xnew = -10:3:10;
% xnew = linspace(-10,10,6); % i like this variant more
ynew = spline(x,y,xnew);
% ynew = interp1(x,y,xnew); % or linear interpolation
darova
darova el 8 de Sept. de 2019
Can you please accept the answer?
John D'Errico
John D'Errico el 8 de Sept. de 2019
I accepted it.
darova
darova el 8 de Sept. de 2019

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation en Centro de ayuda y File Exchange.

Preguntada:

el 31 de Ag. de 2019

Comentada:

el 8 de Sept. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by