I want to reduce the length of the vector called "u1" and make it equal to 1x100.
Follows the code that I'm using:
H = smoothdata(z_a);
figure;
plot(tempo,H, 'g');
[pks,locs]=findpeaks(H, tempo, 'MinPeakProminence', 10,'Annotate', 'extents', 'WidthReference', 'halfheight');
figure;
findpeaks(H, tempo, 'MinPeakProminence', 10,'Annotate', 'extents', 'WidthReference', 'halfheight');
text(locs+.02,pks,num2str((1:numel(pks))'));
prev = 1;
prev1 = 1;
prev2 = 1;
for i = 1:length(pks)
indice1 = pks(i);
index1 = find(H==indice1);
u1 = H(prev:index1);
prev = index1;
accelerazione = z_b(prev1:index1);
prev1 = index1;
velocita = z_c(prev2:index1);
prev2 = index1;
q1 = (length(u1)/100)-0.01;
tempo1 = (0.0:0.01:q1);
tempo3 = (0.0:length(u1)-1);
time(i) = max(tempo1);
[miny1,minyidx1] = min(u1);
minx1 = tempo1(minyidx1);
figure;
subplot(2,1,1);
plot(tempo1,u1);
xlabel('Time(s)');
ylabel('Angolo');
avstr = sprintf('Ripezione n : %.1f ',i);
title(avstr);
hold on
xline(minx1,'r');
legend('Flesso estensione tronco','Finish');
%%media
media = mean(u1);
v(i) = media;
%%media accelerazione
media_acc = mean(accelerazione);
acc_media(i) = media_acc;
%%media velocita angolare
media_veloc=mean(velocita);
veloc_media(i) = media_veloc;
%%varianza
varianza = var(u1);
t(i) = varianza;
%%deviazione standard
deviazione = sqrt(varianza);
o(i) = deviazione;
subplot(2,1,2);
X_axis_normalize = (tempo3/(numel(tempo3)))*100;
plot(X_axis_normalize,u1);
[miny,minyidx] = min(u1);
minx = X_axis_normalize(minyidx);
hold on
xline(minx,'r');
legend('Flesso estensione tronco','Finish');
xlabel('%Cycle');
ylabel('Angoli');
figure;
subplot(2,1,1);
plot(tempo1,accelerazione);
hold on
plot(tempo1,ones(length(tempo1),1)*acc_media(i));
xlabel('Time(s)');
ylabel('Accelerazione(m/s^2)');
avstr1 = sprintf('Ripezione n : %.1f ',i);
title(avstr1);
gravstr1 = sprintf('Valore medio: %.1f ',acc_media(i));
legend('Accelerazione(m/s^2)', gravstr1);
subplot(2,1,2);
plot(tempo1, velocita);
hold on
plot(tempo1,ones(length(tempo1),1)*veloc_media(i));
xlabel('Time(s)');
ylabel('Velocità angolare(rad/s)');
gravstr2 = sprintf('Valore medio(rad/s): %.1f ',veloc_media(i));
legend('Velocità angolare(rad/s)', gravstr2);
end