0
我在matlab中有以下腳本,目標是計算的jacobian,它應該給我一個4乘4的矩陣,而是我得到一個7×4矩陣。我不確定它應該工作的代碼有什麼問題。在matlab中查找矩陣的雅可比
syms m M L J p_x p_theta theta X g K_m K_g r V_in R_m;
h= (m+M)*(m*L^2/4+J) - (m*L/2 * cos(theta))^2;
f_1 = [1/h * [ (m*L^2/4+J)*p_x + m*L/2 cos(theta)* p_theta]];
f_2 = [1/h * [ (m*L/2 * cos(theta))*p_x + (m+M)*p_theta]];
F = K_m *K_g/r *[ (V_in -K_m*K_g * f_1/r)/R_m];
f_3 = F;
f_4 = m*L/2 *sin (theta)*(f_1*f_2+g);
J_1=jacobian([f_1,f_2,f_3,f_4],[X;theta;p_x;p_theta]);
subs(J_1,[X,theta,p_x,p_theta],[0,0,0,0])