Error in the plot function/low resolution

조회 수: 3 (최근 30일)
Pedro Valadao
Pedro Valadao 2021년 2월 5일
답변: Pedro Valadao 2021년 2월 9일
Hi everyone!
I have an EMG signal at 1000Hz. When I use the plot(EMG signal), the x values only move at 10 ms (anything inside this gets the same x value), the y values are working fine (upper pic). If I cut the signal to a smaller piece, the error is gone (lower pic). I need the 1ms resolution to define events.

채택된 답변

Pedro Valadao
Pedro Valadao 2021년 2월 9일
Hi all,
It is not an error. It is just the precision of the datatip function. It is easily adjustable on the following line:
formattedValue = [valueFormat num2str(value,4) removeValueFormat];
i found this info on the following discussion:
Cheers!
Pedro.

추가 답변 (2개)

Maximilian Schönau
Maximilian Schönau 2021년 2월 5일
Hi, it is hard to find (and fully understand) your problem without having your code.
If I understand your question right, you want to be your upper plot in a better resolution. Since you have the data probably available in a better resolution (second plot), I would guess that some function deletes some values on the way, it could be for example the function linspace(x1,x2,resolution) which does this to your data.

Pedro Valadao
Pedro Valadao 2021년 2월 5일
Hi Max,
Thank you for the quick reply! The same error occurs with the following code:
v = rand(1,150000),plot(v) % here the error happens as in the upper figure
figure, plot v(1:200) % here the error does not happen as in the lower figure
I have checked multiple files with the same type of data, .mlx and .m - the same problem happens consistently.
Br, P.
  댓글 수: 4
Pedro Valadao
Pedro Valadao 2021년 2월 5일
Hi, I'm using matlab R2020a installed on my pc.
v = rand(1,150000)
figure, subplot(2,1,1), plot(v), subplot(2,1,2), plot(v(1:200))
If I zoom both a lot and use the data tips, the following happens:
Pedro Valadao
Pedro Valadao 2021년 2월 8일
sorry if this is too much of a newby question, I'm tagging you because you have answered pretty much all questions I have seen in this forum! haha
Could you please help?
Br, Pedro.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by