Create the x axis to my need

12 visualizaciones (últimos 30 días)
David Peña
David Peña el 19 de Mzo. de 2022
Comentada: Arif Hoq el 21 de Mzo. de 2022
Hello and thanks in advanced!
I´m having problems ploting some data I receive from an OBR. The problem is that the data I receive comes separated, on the one hand I have the y axis data (50x1 double) and on the other hand I have the x axis data (4096x1 double). The problem comes when I try to plot because if I try to decimate the graph I get is not perfect do to 4096 and 50 not been multiples.
So as the data received in the x axis is not important i have tried to create my own x axis and here is where my doubt is. I need this x axis to have the same length as the y axis so I can plot them together but the x axis must have every digit of the array separated 0.5 cm.
y = transpose((0:1:49));
xaxis = transpose((0:0.5:length(y)));

Respuesta aceptada

Arif Hoq
Arif Hoq el 20 de Mzo. de 2022
try this:
y = transpose((0:1:49));
xaxis = transpose(1:0.5:length(y)/2+1/2);
plot(xaxis,y)
  3 comentarios
David Peña
David Peña el 21 de Mzo. de 2022
Thanks, it worked perfectly!
Arif Hoq
Arif Hoq el 21 de Mzo. de 2022
@David Peña please mark this question as a "Accepted answer"

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by