Reference to non-existent field 'aD42'? Please help.
1 view (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 8 Dec 2012
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.
Accepted Answer
Matt Fig
on 8 Dec 2012
Edited: Matt Fig
on 8 Dec 2012
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.
More Answers (1)
See Also
Categories
Find more on MuPAD in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!