title: MATLAB: Subscript indices must either be real positive integers or logicals
body: <p>Getting this error message:"Subscript indices must either be real positive integers or logicals". Not really sure why? I've attempted correcting it with no success. Do i need to write out the numeric values I am trying to use in my calculation?</p>
  
  <pre><code>function [ T,P,rho ] = stdatm( h );
  T0=288.16;
  P0=101.325;
  rho0=1.225;
  a=-6.5*10^-3;
  b=3*10^-3;
  c=-4.5*10^-3;
  d=4.0*10^-3;
  R=286.9;
  g=9.81;
  
  T1=T0+a*11000;
  P1=P0(T1/T0)^(-g/(a/R));
  rho1=rho0(T1/T0)^((-g/(a/R))-1);
  </code></pre>