title: MatLab: how to define (not constant) properties that depend on other properties?
body: <p>In the following class</p>
  
  <pre><code>classdef ClassCar
    properties (Constant)
      % Car phyisical properties
      m = 1630;         % [kg]
      R_rim = 14*.0254; % [m]
      e_tire = .175*.55; % [m]
      R_e = ClassCar.R_rim + ClassCar.e_tire;                   % &lt;= HERE
  
      % Car transmission properties
      gearRatios = [3.154 1.925 1.281 .951 .756];
      finalDrive = 3.05; %Rapport de differentiel
      overallRatios = ClassCar.gearRatios * ClassCar.finalDrive;% &lt;= HERE
    end
  end
  </code></pre>
  
  <p>I want to have composed properties which depend on other properties (as a shortcut). I.e. to retrieve from an instanciated object (car = ClassCar)</p>
  
  <pre><code>car.R_e
  </code></pre>
  
  <p>or</p>
  
  <pre><code>car.overallRatios
  </code></pre>
  
  <p><strong>The problem is R_e is a function of R_rim and e_tire.</strong>
  <strong>With (Constant) properties, it works</strong>, but the problem is I want those properties <strong>not constant</strong>, and simply removing the keyword causes problems.</p>
  
  <p>Then I tried to do it with help of methods</p>
  
  <pre><code>classdef ClassCar
    properties
      % Car phyisical properties
      m = 1630;         % [kg]
      R_rim = 14*.0254; % [m]
      e_tire = .175*.55; % [m]
  
      % Car transmission properties
      gearRatios = [3.154 1.925 1.281 .951 .756];
      finalDrive = 3.05; %Rapport de differentiel
    end
    methods (Static)
      function value = R_e()
          value = R_rim + e_tire;                       % &lt;= HERE
      end
      function value = overallRatios()
          value = gearRatios * finalDrive;
      end
    end
  end 
  </code></pre>
  
  <p>But even with keyword (Static) for method, I get <strong>error message</strong> "Undefined function or variable 'R_rim'." I tried typing self.R_rim, ClassCar.R_rim, in vain.</p>
  
  <p><strong>How to achieve that? Is this the best way to do ?</strong> If so, how to access the object's properties (sthg like self.value)?</p>
  
  <p>Thanks.</p>