필터 지우기
필터 지우기

Arrays have incompatible sizes for this operation.

조회 수: 2 (최근 30일)
Syazana
Syazana 2023년 8월 1일
댓글: Dyuman Joshi 2023년 8월 1일
Hello! I want to calculate the acceleration but there's error which is I don't know what's need to be amend .
All the array here have the same dimension which is 1x47
s2= sind([-23.155386 -23.124987 -23.104193 ...])
s3= sind([38.535091 39.562313 40.583305 ...])
c2=cosd([-23.155386 -23.124987 -23.104193 ...])
c3=cosd([ 38.535091 39.562313 40.583305 ...])
c4=cosd([86.32077 86.347443 86.42453 ...])
s4=sind([86.32077 86.347443 86.42453 ...])
s5=sind ([ -35.981091 -36.282097 -36.616375 ...])
c5=cosd([-35.981091 -36.282097 -36.616375 ...])
c6=cosd([-29.205807 -29.200783 -29.196812 ...])
s6=sind([-29.205807 -29.200783 -29.196812 ...])
c7=cosd([-37.455574 -37.206734 -36.926373 ...])
s7=sind([-37.455574 -37.206734 -36.926373 ...])
diff_q1t=[-0.752469036 -0.785655599 -0.821694903 ...])
diff_q2t=[0.057738982 0.04467432 0.024727825 ...])
diff_q3t=[1.798555686 1.787403904 1.77699127 ...])
diff_q4t=[-0.204530772 -0.170022994 -0.123331074 ...])
diff_q5t=[-0.441452236 -0.443240326 -0.451332545 ...])
diff_q6t=[-0.016948892 -0.003593633 0.004956735 ...])
diff_q7t=[0.349886155 0.354433611 0.363348752 ...])
diff_q1t_second_derivative = diff(diff_q1t)
% Time array
time = (-0.4:0.01:0.06)
% here is my equation for acceleration
NaAstar_a1 = ((pA.*(s3.*diff_q2t + c2.*c3.*diff_q1t) - pA.*(s2.*diff_q1t + diff_q3t)).*(s2.*diff_q1t + diff_q3t) - pA.*(c2.*s3.*diff_q1t_second_derivative - c3.*diff_q2t + s3.*diff_q3t.*diff_q2t + c2.*c3.*diff_q3t.*diff_q1t - s2.*s3.*diff_q2t.*diff_q1t) - pA.*(s2.*diff_q1t_second_derivative + c2.*diff_q2t.*diff_q1t + diff_q3t + (pA.*(s3.*diff_q2t + c2.*c3.*diff_q1t) - pA.*(c3.*diff_q2t - c2.*s3.*diff_q1t)).*(c3.*diff_q2t - c2.*s3.*diff_q1t)));
  댓글 수: 5
Syazana
Syazana 2023년 8월 1일
Oh ya sorry for misundertsanding, then how I can set the second derivate of diff_q1t to be the same array as diff_q1t? Is it true if I set like this since the -1.4454 is the min number in the diff_q1t
diff_q1t_second_derivative = diff([-1.4454 diff_q1t])
Dyuman Joshi
Dyuman Joshi 2023년 8월 1일
You can put any number there, but the final output value(s) will depend on the number.
You can also use gradient instead of diff

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by