MATLAB: 2 Variables and 2 Unknowns Returning Incorrect Results

dynamicsMATLAB and Simulink Student Suitephysicssymbolic equation

I am trying to solve a problem involving collisions, oblique collisions to be exact.
First attempt:
VA1=2
VB1=3
m1=0.5
m2=0.4
ThetaA1=30
ThetaB1=50
VA1x = m1*VA1*cosd(ThetaA1);
VB1x = m2*VB1*cosd(ThetaB1);
syms VA2x VB2x
equ1 = m1*VA1x + m2*VB1x == m1*VA2x + m2*VB2x;
equ2 = -0.5*(VB1x - VA1x) == (VB2x - VA2x);
sol = solve ([equ1,equ2],[VA2x,VB2x]);
solVA2x = sol.VA2x;
fprintf('solution is %i \n', solVA2x)
For my second attempt:
VA1=2
VB1=3
m1=0.5
m2=0.4
ThetaA1=30
ThetaB1=50
VA1x = m1*VA1*cosd(ThetaA1);
VB1x = m2*VB1*cosd(ThetaB1);
syms VA2x VB2x
sol=solve([m1*VA1x + m2*VB1x == m1*VA2x + m2*VB2x , 0.5 == -(VB2x - VA2x)/(VB1x - VA1x)],[VA2x,VB2x]);
C=sol.VA2x;
E=sol.VB2x;
fprintf('Value for VA2x %i \n',C);
fprintf('Value for VB2x %i \n',E);
I am pretty unexperienced and willing to learn so any additional references would be appreciated. I have read that I should add vpasolve however I have already tried that and the results are the same.

Best Answer

fprintf('solution is %g \n', solVA2x)
The %i format is only for integers.