getting help for fitting a signal

Hello! I'm working for my thesis degree and I need your help to finisch a script in Matlab.
my goal was to synchronize the signals detected by two different devices. The two signals have a different number of samples. I want both signals start where there is their maximum value (and I just did this with matlab) but I want it to start at the same time and I want that one of these signal ends where the other ends. How can I write it in matlab??
this is my script, where two signals are taken out from file A and file B respectively :
A = load( 'C:\Users\user\Desktop\Gyko\lucamolinaro_sessione2.lvm'); % it is the file from first instrument
B = load ('C:\Users\user\Desktop\Gyko\lucamolinaro_gyko_sessione2.txt'); it is the file from second instrument
C = resample (A,500,1000); % I created C so that all the instruments working at the same sampling frequency ( from 1000 Hz to 500 Hz)
t = C(:,1);
RAW = C(:,2:7);
%F = C(:,8:10);
F = C(:,10) % I consider only the third component of F (F along z.-axes)
[temp,frame_Fmax] = max(F)
Fnew = F(frame_Fmax : end) % Fnew go from its maximum peac to the end
figure;
plot(Fnew)
M = C(:,11:13);
a_x= B(:,1); % ax è la prima colonna del file estratto dal Gyko (B)
a_y= B(:,2);
a_z = B(:,3);
[temp,framea_zmax]= max(a_z) % I create a temporary file max (a_Z)
a_z_new = a_z(framea_zmax:end) % a_Z_new go from its maximum peac to the end
figure;
plot(a_z_new)
%plot (a_x,'k')
%hold on;
%plot(a_y,'r')
%hold on;
%figure;
%plot(a_z,'m')
xlabel ('samples' number')

Answers (0)

Categories

Asked:

on 26 Oct 2015

Edited:

on 26 Oct 2015

Community Treasure Hunt

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

Start Hunting!