Info

此问题已关闭。 请重新打开它进行编辑或回答。

Making my code run to analyze different data

1 次查看(过去 30 天)
Below you can see my code to analyze a huge set of data. That data is the left hip angle. The code that is posted is looking at the angles in the first column only. I need to change the code so that it takes the data from 1,10,and 25 column row 1-153. Other than that the code is the same. I just cannot get it to run and need help. Thank You so much! clc clear all M = dlmread('LeftHipAngle.txt','\t',4,1); x = M(:,1)*pi/180; rate = 120; xfindex = max(find(x)); for i = 1:xfindex time(i) = 1/rate*i; theta(i) = x(i); end
for i = 2:( xfindex - 1 ) tadj1( i - 1 ) = time( i ); cdiff( i - 1 ) = ( theta( i + 1 ) - ... theta( i - 1 ) ) / ( 2 * 1 / rate ); end
for i = 1:( xfindex - 2 ) tadj2( i ) = time( i ); onesider( i ) = ( -3 * theta( i ) + ... 4 * theta( i + 1 ) - theta( i + 2 ) ) / ... ( 2 * 1 / rate ); end plot(time, theta) xlim([0 max(time)]) grid on hold on plot(tadj1, cdiff, 'r--') hold on plot(tadj2, onesider, 'g-.') xlabel('Time, t (s)') title('Figure 1: Biomechanics Research') legend('Angular Position, \theta (rad)', ... 'Centered Diff. Angular Velocity, \omega_1 (rad/s)', ... 'One-Sided Diff. Angular Velocity, \omega_2 (rad/s)')

回答(0 个)

此问题已关闭。

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by