title: Common factor of a coefficient
body: <p>I am doing a computer engineering project whereby I must extract what I believe to be a common factor from a multiplication and addition operation, which my friend said can be done in MATLAB.</p>
  
  <p>Basically if I have some coefficients x,y, and z, and I want to compute the result of multiplying against a set of numbers which can change and summing the result as such</p>
  
  <p>3x+2y+1z</p>
  
  <p>I would like to get a factor (lets call it "w") from the coefficients so instead of doing 3 multiplies and 3 additions, I can just do 3 additions and one multiply and get the same result as such:</p>
  
  <p>w(1+2+3)</p>
  
  <p>My friend said this can be done in MATLAB to find that "w" but I have been googling "factoring from expression" and different variations of it but to no avail. I would appreciate it if anyone you understands what I am trying to do in MATLAB could point me in the right direction</p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT</strong>
  x,y,z, and w are numbers, I just put them as variables to illustrate my point</p>