Plots aren't showing the whole array!

3 views (last 30 days)
Johannes Graf
Johannes Graf on 16 Oct 2023
Commented: Mathieu NOE on 19 Oct 2023
Hi,
I received data which I have to evaluate. The data is "nearly" the same as a square wave signal. My job as simple as it appears, is to locate those points in the array where either the values suddenly rise or suddenly drop. I did this by analysing the deriviation of the data according to x. I let that deriviation plot by Matlab, but it's only showing me those peaks with positive gradient. I investigatet my data and recognized that the x-values of negative gradients are single values surrounded by those of positive gradients. Or let me say it differently: 397 Eeements of my deriviation vector are positive and only three are negative.
What could be the problem, inducing my plot to not show those points?
  3 Comments
Johannes Graf
Johannes Graf on 16 Oct 2023
Edited: Johannes Graf on 16 Oct 2023
Thanks for answering, right now in the moment I was able to solve it but I will state my process. Maybe it's helpfull for others :/
I deriviated numerally by
for i=1:(length(phi_K)-1)
d_phi_K(i)=(c_z_ges(i+1)-c_z_ges(i))/(phi_K(i+1)-phi_K(i));
end
then middled phi_K by
for i=1:(length(phi_K)-1)
phi_K_opt(i)=sum([phi_K(i) phi_K(i+1)])/2;
end
Than averaged the whole of d_phi_K and looked for the values which are greater in amount than the average. Until now the code was working as fine as I expected it. But when I plotted it the problem of my question appeared.
I'd overseen, that the absolute value of the negative gradients is much smaller than the maximum of my deriviation vector. So the only thing I had to do in the end was, to change the scaling of my plot to ylim([min(d_phi_K) -min(d_phi_K)]).
Mathieu NOE
Mathieu NOE on 19 Oct 2023
can you share some data and a working code ?

Sign in to comment.

Answers (0)

Tags

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!