PLEASE HELP! How to align or adjust 4 figures showing sensor data?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Dear communuity,
I spent several days to create one figure of gyroscoe sensor data wich shows the given data in perfect overlay. Needed firues attached.
But I can't idenify my mistake in the following script or how to solve of extracting the needed data from my figures. The shown cycles (data points) in the figures schould be visualised in the new plot, too.
close all, clear all
P1= openfig('1_Ap_gz_VR_perfekt_linkehand_langeseite.fig', 'reuse');
b1 = get(gca,'Children');
c = get(b1,'Type');
b = findobj(gca,'Type','Line');
set(b,'Color',[1 0.466666666666667 0]);
xdata1= get(b1, 'XData');
ydata1 = get(b1, 'YData');
zdata1 = get(b1, 'ZData');
%hier wollte ich einen datarange auswählen von einerr fig um die synchron
%übereinander zu layern
%h = findobj(gca,'Type','line')
%x=get(h,'Xdata') ;
%y=get(h,'Ydata') ;
%(x,y) is your required data.
P2= openfig('3_Ap_gz_VR_perfekt_linkehand_langeseite.fig','reuse');
b2 = get(gca,'child');
c = get(b2,'Type');
b = findobj(gca,'Type','Line');
set(b,'Color',[0.372549019607843 0.63921568627451 0.0196078431372549]);
xdata2= get(b2, 'XData');
ydata2 = get(b2, 'YData');
zdata2 = get(b2, 'ZData');
P3= openfig('16_AP_gyro_z__VL.fig','reuse');
b3 = get(gca,'child');
c = get(b3,'Type');
b = findobj(gca,'Type','Line');
set(b,'Color',[0.494117647058824 0.184313725490196 0.556862745098039]);
xdata3= get(b3, 'XData');
ydata3 = get(b3, 'YData');
zdata3 = get(b3, 'ZData');
P4= openfig('18_AP_gyro_z__VR.fig','reuse');
b4 = get(gca,'child');
c = get(b4,'Type');
b = findobj(gca,'Type','Line');
set(b,'Color',"b");
xdata4= get(b4, 'XData');
ydata4 = get(b4, 'YData');
zdata4 = get(b4, 'ZData');
%find the optimal alignment for the simulated data
[~,idx]=max(xcorr(ydata1, ydata2, ydata3, ydata4)); %idx=index where cross correlation is maximum
t2adj=t2+idx-N; %shift the time base for x2
figure
h1=axes;
Q1=copyobj(allchild(get(P1,'CurrentAxes')),h1);
hold on
Q2=copyobj(allchild(get(P2,'CurrentAxes')),h1);
hold on
Q3=copyobj(allchild(get(P3,'CurrentAxes')),h1);
hold on
Q4=copyobj(allchild(get(P4,'CurrentAxes')),h1);
%ich glaube, das hier soll die range der x-Achse definfieren, und zwar
%welche für jeden plot angezeigt wird -> funktioniert
h1.XLim = [83 84];
hL=findobj(h1,'LineStyle','-');
legend(hL,'Pferd 1 ','Pferd 3','Pferd 16', 'Pferd 18',"edgecolor","white",'Fontsize', 13);
at the moment my figure looks like that:![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1490482/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1490482/image.jpeg)
but it should change like this kind of example (https://de.mathworks.com/matlabcentral/answers/1888002-how-can-i-align-multiple-curves-on-one-plot-to-a-central-point)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1490487/image.png)
I hope somebody can help and explain where I've made a mistake.
0 comentarios
Respuestas (1)
Sulaymon Eshkabilov
el 22 de Sept. de 2023
According to the figures that attached to your post without looking at your code:
initial observations are:
(1) Sensor readings (gyro) shows that some unstable reading
(2) or if your gyro sensor reading is ok, then the gyro position was changed abruptly.
(3) your data sampling rate seems in your gyro sensor to be a bit slower than it should be.
Check these issues and address them accordingly before coding.
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!