Need help with Integration of acceleration matrix and updating input.

1 view (last 30 days)
Hi,
I have 2 questions regarding Integration.
I have an Input matrix with 12 rows and 1 column. First 6 rows are vertical displacement, velocity, acceleration and Torsional displacement, velocity,acceleration respectively.
1). I am trying to integrate acceleration(vertical and torsional) matrix(output3) to get velocity and displacement, but I am getting an error "Error using trapz (line 59) LENGTH(X) must equal the length of Y in dim 1."
2). And I want to replace the input with my output after integration.
could anyone please help me with this?
t_start = 0;
dt = 0.0128;
N = 46995;
t = t_start + (0:N-1)*dt;
t1 = t_start + (0:23497-1)*dt;
t2 = 300.7616 + (0:23498-1)*dt;
InputActual = input2(:,1);
output3=zeros(2,23498);
vel=zeros(2,23498);
disp = zeros(2,23498);
for i = 1:23498-1
output3(:,i) = net(InputActual);
vel(:,i) = trapz(t2,output3(:,i),1);
disp(:,i)= trapz(t2,vel(:,i),1);
InputActual =[output3(1,i);vel(1,i);disp(1,i);output3(2,i);vel(2,i);disp(2,i);input2(7:end,i+1)];
end

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!