Reference to non-existent field 'aD42'? Please help.
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to calculate the acceleration of a mechanism and I am stuck with this error:
Reference to non-existent field 'aD42'.
Error in xyz12 (line 285) aDpds = eval(solaD.aD42);
here are the code lines that describe the acceleration and the aD42 variable:
aE=[0 0 0];
ep5z = sym('ep5z','real');
ep5 = [ 0 0 ep5z ];
aD42=sym('aD42','real');
aD4D2 = [ aD42*cos(phi4) aD42*sin(phi4) 0 ];
aD5=aE+cross(ep5,rD-rE)- dot(Omega5,Omega5)*(rD-rE);
aD4 = aD5;
aD4D2cor = 2*cross(omega2,VD42);
eqaD = aD4 - ( aB2 + aD4D2 + aD4D2cor );
eqaDx = eqaD(1); eqaDy = eqaD(2);
solaD = solve(eqaDx,eqaDy);
ep5zs = eval(solaD.ep5z);
aDpds = eval(solaD.aD42);
Ep5 = [0 0 ep5zs];
AD42 = aDpds*[cos(phi4) sin(phi4) 0];
AD5=aE+cross(Ep5,rD-rE)-...
dot(Omega5,Omega5)*(rD-rE);
댓글 수: 2
Walter Roberson
2012년 12월 8일
Put a breakpoint after the solve() and see what fields were returned for solaD
Note: you should not eval() a symbolic variable. symbolic variables are not MATLAB expressions, they are just very similar to MATLAB expressions. You should subs() or double() the symbolic variable.
채택된 답변
Matt Fig
2012년 12월 8일
편집: Matt Fig
2012년 12월 8일
Use this line:
solaD = solve(eqaDx,eqaDy,ep5z,aD42)
Instead of the one you use for solaD. The problem is you have three unknowns and two equations, so SOLVE chose to leave aD42 as the independent variable in the solutions.
Also, when you call FPRINTF with a symbolic variable you need to convert in with CHAR first.
fprintf('aD4D2cor = [%g, %g, %d] (m/sˆ2)\n', char(aD4D2cor))
and so for the rest.
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MuPAD에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!