title: Plottability of scalar times vector products
body: <p>I have created two functions: <code>frame</code> and <code>t1</code>. The first one (for simplicity I have replaced a certain matrix with <code>eye</code> here) returns three 3-dimensional vectors.</p>
  
  <pre><code>function [frames] = frame(a1,a2,a3)
  
        L = a1*a2*a3*eye(3);
  
        frames(1,:)= L*([1,0,0])';
        frames(2,:)=L*([0,1,0])';
        frames(3,:)=L*([0,0,1])';
  
  end
  </code></pre>
  
  <p>The second function takes two scalars (<code>B</code>, <code>phi1</code>) and three vectors (through the matrix <code>Frame</code>) as input and returns another one:</p>
  
  <pre><code>function [t1] = t1(B,Frame,phi1) 
  
   ex=Frame(1,:);
   ey=Frame(2,:);
   ez=Frame(3,:); 
  
   t1 = -sin(phi1)*ex  - cos(B)*cos(phi1)*ey  + cos(phi1)*sin(B)*ez ;
  
  end
  </code></pre>
  
  <p>When I want to plot or do any operations with <code>phi1</code> or <code>B</code> being vectors, clearly I encounter problems, because terms like <code>sin(phi1)*ex</code>end up having the wrong dimensions. Replacing them with <code>sin(phi1).*ex</code> is also clearly wrong, as <code>ex</code> will always have dimension 3, whereas <code>sin(phi1)</code> will have the dimension of <code>phi1</code>.</p>
  
  <p>Example:</p>
  
  <pre><code>phi1=linspace(0,2*pi);
  plot(phi1,t1(pi/2,frame(1,1,1),phi1))
  </code></pre>
  
  <p>.</p>
  
  <pre><code>Error using  * 
  Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the
  number of rows in the second matrix. To perform elementwise multiplication, use '.*'.
  </code></pre>
  
  <p>What is a workaround this problem, that I have encountered in many other instances?  </p>