title: Error using ^ Inputs must be a scalar and a square matrix. To compute elementwise POWER, use POWER (.^) instead
body: <p>I am trying to create plots using this code:</p>
  
  <pre><code>ms = 0.47675;
  
  mp = 0.00095;
  
  d = 0.2990;
  
  g = 9.81;
  l = 0.579;
  
  R = [0.515 0.437 0.361 0.283 0.203 0.1209];
  
  theta=[0.1585 0.1325 0.1090 0.0870 0.0615 0.0360];
  
  T = [1.234 1.232 1.231 1.233 1.230 1.230];
  
  M=ms+mp;
  
  for  y=1:length(R);
      l(y)=(1/12)*ms*l^2+ms*d^2+mp*R(y)^2;
      h(y)=d*(1-cos(theta(y)));
      w(y)=sqrt(2*M*g*h(y)/l(y));
      vp(y)=(2*g*M*d*T(y)*sin(theta(y)/2))/(mp*R(y)*2*pi);
      pf(y)=mp*vp(y);
      pe(y)=M*d*w(y);
      Ee(y)=M*g*h(y);
      Ef(y)=(mp*vp(y)^2)/2;
      Ediff(y)=Ee(y)-Ef(y);
      pdiff(y)=pe(y)-pf(y);
  
  end
  
  plot(R,Ediff '*')
  
  title'skillnad mellan 'totala energi f?re och efter st?t'
  
  xlabel 'Avst?nd mellan pilens tr?ffpunkt och rot.axel(m)'
  
  ylabel "\Delta'E(J)'
  
  axis ([0 0.6 -0.4 -0.3])
  </code></pre>
  
  <p>But i keep getting the error:</p>
  
  <blockquote>
    <p>Error using  ^  Inputs must be a scalar and a square matrix. To
    compute elementwise POWER, use POWER (.^) instead.</p>
  </blockquote>
  
  <p>Please if someone could help me and tell me whats wrong with my code</p>