Adjust samples in one signal after move a second signal in the time (x) axis

1 次查看(过去 30 天)
Hi, everyone.
I'm plotting two signals, as can be seen in the next image:
The time and voltage are 2 different arrays that are plotted for each signal. The 2 arrays for the blue signal are attached to this description and are time5a14_S1R1_TAI and SM_TAI_S1R1_5A14. The 2 arrays for the red signal are attached to this description and are time5a14_S1R1_TAD and SM_TAD_S1R1_5A14. My code for this plot is the next one:
load('time5a14_S1R1_TAI')
load('time5a14_S1R1_TAD')
load('SM_TAI_S1R1_5A14')
load('SM_TAD_S1R1_5A14')
lim5=5;
lim14=14;
figure %Graficar en una figura diferente
plot(time5a14_S1R1_TAI,SM_TAI_S1R1_5A14,'b','linewidth',2) %Graficar señal filtrada contra el tiempo
hold on
plot(time5a14_S1R1_TAD,SM_TAD_S1R1_5A14,'r','linewidth',2) %Graficar señal filtrada contra el tiempo
hold off
grid on
legend('Tibial Anterior Izquierdo (Envolvente)','Tibial Anterior Derecho (Envolvente)')
xlabel('Tiempo (seg)')
ylabel('Voltaje (mV)')
title('Datos de EMG filtrados - Sensor Tibial Anterior Derecho e Izquierdo (S1R1)')
xlim([lim5 lim14]) %Graficar en cierto límite del tiempo
I need to move the red signal to the left, as can be seen in the next image:
My code for this plot is similar to the first one, and is this:
lim5=5;
lim14=14;
figure %Graficar en una figura diferente
plot(time5a14_S1R1_TAI,SM_TAI_S1R1_5A14,'b','linewidth',2) %Graficar señal filtrada contra el tiempo
hold on
plot(time5a14_S1R1_TAD(1:end-673),SM_TAD_S1R1_5A14(674:end),'r','linewidth',2) %Graficar señal filtrada contra el tiempo
hold off
grid on
legend('Tibial Anterior Izquierdo (Envolvente)','Tibial Anterior Derecho (Envolvente)')
xlabel('Tiempo (seg)')
ylabel('Voltaje (mV)')
title('Datos de EMG filtrados - Sensor Tibial Anterior Derecho e Izquierdo (S1R1)')
xlim([lim5 lim14]) %Graficar en cierto límite del tiempo
My problem is that I need to adjust the samples from the blue signal, because I already did a manipulation in the red one to be plotted from different points in the array. But I don't know how to do it and I can't find didactit information about this kind of adjust of samples in MATLAB.
If someone can help me I would be really grateful.
  1 个评论
José Santos Pérez Leal
编辑:José Santos Pérez Leal 2021-7-20
I think I already solve this problem. What I need is to obtain all the arrays in the second plot to be with the same length, and I solve it by doing the next code, in case it helps someone:
load('SM_TAI_S1R1_5A14')
load('time5a14_S1R1_TAI')
SM_MO=SM_TAI_S1R1_5A14(1:end-673);
time5a14_S1R1_TAI_MO=time5a14_S1R1_TAI(1:end-673);
plot(time5a14_S1R1_TAI_MO,SM_MO)
load('SM_TAD_S1R1_5A14')
load('time5a14_S1R1_TAD')
SM_MO2=SM_TAD_S1R1_5A14(674:end);
time5a14_S1R1_TAD_MO2=time5a14_S1R1_TAD(1:end-673);
plot(time5a14_S1R1_TAD_MO2,SM_MO2)
figure
plot(time5a14_S1R1_TAI_MO,SM_MO,'b')
hold on
plot(time5a14_S1R1_TAD_MO2,SM_MO2,'r')
The four arrays involved in the plot are 11928X1, the same length in all the arrays after the adjust of samples

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by