Substituting values for syms yet answer still in terms of syms

1 view (last 30 days)
I am trying to substitute an initial value (t=0) for "t" in my code but my results are still in terms of "t" and not zero. I commented the problematic output in the code below.
%%Variables
syms phi1 phi2 phi3 x1 y1 x2 y2 x3 y3 t
%%Geometry of Slider-Crank
L1 = 1.4;
L2 = 1.8;
e = 0.15;
r1 = [x1;y1];
r2 = [x2;y2];
r3 = [x3;y3];
%%Roatation Matrices
A1 = [cos(phi1) -sin(phi1);sin(phi1) cos(phi1)];
A2 = [cos(phi2) -sin(phi2);sin(phi2) cos(phi2)];
A3 = [cos(phi3) -sin(phi3);sin(phi3) cos(phi3)];
B1 = [-sin(phi1) -cos(phi1);cos(phi1) -sin(phi1)];
B2 = [-sin(phi2) -cos(phi2);cos(phi2) -sin(phi2)];
B3 = [-sin(phi3) -cos(phi3);cos(phi3) -sin(phi3)];
R = [0 -1;1 0];
%%Relative Coordinates
s1O = [-L1/2; 0];
s1P = [L1/2; 0];
s2P = [-L2/2;0];
s2Q = [L2/2;0];
s3Q = [0;0];
v3X = [1;0];
rO = [0;0];
rR = [0; -e];
vY = [0;1];
%%Jacobian
q = [r1.',phi1,r2.',phi2,r3.',phi3];
PHI(q) =[r1+A1*s1O; r1+A1*s1P-r2-A2*s2P; r2+A2*s2Q-r3; (vY.')*(r3-rR); (vY')*A3*v3X; phi1-pi/3-0.5*t-t^2];
%
Jq = jacobian(PHI,q);
Jt =jacobian(PHI,t);
%%Newton Raphson Method: Determining Initial Position
q0= [0.34; 0.61; pi/3; 1.26; 0.53; -pi/3; 2; -0.16; 0.01];
t=0;
dq0= [0;0;0;0;0;0;0;0;0];
for i=1:1:5
q0=q0+dq0;
x1 =q0(1,1);
y1 =q0(2,1);
phi1=q0(3,1);
x2=q0(4,1);
y2=q0(5,1);
phi2=q0(6,1);
x3=q0(7,1);
y3=q0(8,1);
phi3=q0(9,1);
r1 = [x1;y1];
r2 = [x2;y2];
r3 = [x3;y3];
q = [r1.',phi1,r2.',phi2,r3.',phi3];
A1 = [cos(phi1) -sin(phi1);sin(phi1) cos(phi1)];
A2 = [cos(phi2) -sin(phi2);sin(phi2) cos(phi2)];
A3 = [cos(phi3) -sin(phi3);sin(phi3) cos(phi3)];
B1 = [-sin(phi1) -cos(phi1);cos(phi1) -sin(phi1)];
B2 = [-sin(phi2) -cos(phi2);cos(phi2) -sin(phi2)];
B3 = [-sin(phi3) -cos(phi3);cos(phi3) -sin(phi3)];
R = [0 -1;1 0];
PHI0 =[r1+A1*s1O; r1+A1*s1P-r2-A2*s2P; r2+A2*s2Q-r3; (vY.')*(r3-rR); (vY')*A3*v3X; phi1-pi/3-0.5*t-t^2];
Jq0=Jq(x1,y1,phi1,x2,y2,phi2,x3,y3,phi3);
d=Jq0\-PHI0;
dq0=double(d);
end
position = q0
%%Velocity Equation Solving for the vector of generalized velocities(q dot)
t0=0;
Jt0=subs(Jt,t,0); %%PROBLEM still outputs in terms of t
vpa(Jt0,10)
Any suggestions are appreciated
Thank you,
Joey

Answers (0)

Categories

Find more on Equations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!