plot() shows multiple y values for the same x value
Show older comments
Hi,
I imported a very long one row vector of sampling data to matlab. There are some outliers which I like to manually delete. Therefore I plotted the sampling data and searched for the outliers. But it turned out that the data tip doesn't show the exact x value for the outlier. In fact it does show a number of y values for the same x value as in the screenshot. I tried several methods for the x vector but before I realized that the displayed x value is wrong. See my code below. SampleData is a 1x1365252 double vector, so naturally N is 1365252.
Is there a way to get the correct postition without zooming in all the way? It'll be a huge hustle to do that for every outlier.
% Import sampling data
delimiterIn = ' ';
headerlinesIn = 0;
SampleData=transpose(importdata('Messelektronik2020_150er_64OSR_230400Baud_ISR_Sample_2.log', delimiterIn, headerlinesIn));
% determine how many samples there are in total
N=length(SampleData);
% generate x vector
x=linspace(0,N-1,N);
% plot
figure (1);
plot(x, SampleData);

Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!