My code is as follows

`syms I_1 phi_1_d2 R_1 f_g mu_1 I_2 phi_2_d2 R_2 mu_2eq_1= mu_1== I_1 * phi_1_d2 + R_1 * f_g;eq_2= mu_2== I_2 * phi_2_d2 - R_2 * f_g;eq_1= expand(eq_1 * (I_2 * R_1));eq_2= expand(eq_2 * (I_1 * R_2));eq_3= eq_1 - eq_2;eq_3= collect(eq_3, [I_1, I_2]);eq_3= collect(eq_3, f_g);eq_4= eq_3 / ((I_2 * (R_1 ^2)) + (I_1 * (R_2 ^2)));eq_4= collect(eq_4, f_g)`

With the output being

`eq_4 = (R_1*mu_1*I_2 + (-R_2*mu_2)*I_1)/(I_2*R_1^2 + I_1*R_2^2) == ((I_2*R_1^2 + I_1*R_2^2)/(I_2*R_1^2 + I_1*R_2^2))*f_g + (I_1*I_2*(R_1*phi_1_d2 - R_2*phi_2_d2))/(I_2*R_1^2 + I_1*R_2^2)`

This is correct as far as I can tell, however I'm unsure how to make matlab recognise that the coefficient for the f_g term is 1

Any help would be appreciated, I am new to MATLAB and unfamiliar with the symbolic toolkit

## Best Answer