To run:

>> n=4;  % 4-by-4
>> R = 5000 + 500*rand(n); % resistance matrices
>> h=CAheart(n, '', R,R);  % see help CAheart for this command and more options
>> global stat; stat=cell(n^2,1); % for bookkeeping
>> s=h.simulate(2000);  % 2000 ms
>> h.plot(s,1);  % can plot 1:n^2

To re-simulate the same system:
>> h.reset  % this will re-initialize
>>h.simulate(3000);

To create a new system, it is safest to first run
>> clear class functions all
Then run the above again with the new parameters (e.g. a different n).

Parameter values can be read in the function generate_params in file MyocyteVisibleEP.m. Out of the box, they are (with randomized = 0, all myocytes get the same value for a given parameter):

params = zeros(n,n,16);
            % d (current upstroke slope, phase 0)
            params(:,:,obj.ixUPSTROKE_SLOPE) = 6 + randomized*0.1*(-1 + 2*rand(n));
            % g (notch, phase 1)
            params(:,:,obj.ixNOTCH_SLOPE) = -1 + randomized*0.05*(-1 + 2*rand(n));
            % b (phase 3 ERP)
            params(:,:,obj.ixERP_SLOPE) = -2 + randomized*0.1*(-1 + 2*rand(n));
            % d2 (upstroke 2)
            params(:,:,obj.ixUPSTROKE2_SLOPE) = 3 + randomized*0.1*(-1 + 2*rand(n));
            % Vth for depolarization
            params(:,:,obj.ixVTH) = -80 + randomized*2*(-1 + 2*rand(n));
            % Vmax
            params(:,:,obj.ixVMAX) = 52 + randomized*2*(-1 + 2*rand(n));
            % Vplateau (transition from Notch to Plateau)
            params(:,:,obj.ixVPLATEAU) = 0.9*params(:,:,obj.ixVMAX);
            % PD (plateau duration)
            params(:,:,obj.ixPLATEAU_DURATION) = 100 + randomized*10*(-1 + 2*rand(n));
            % Vth2 > Vth (remember Vth is negative)
            params(:,:,obj.ixVTH2) = 0.7*params(:,:,obj.ixVTH);
            % Vmax2 < Vmax
            params(:,:,obj.ixVMAX2) = 0.7*params(:,:,obj.ixVMAX);
            % Vmin (voltage when quiescent)
            params(:,:,obj.ixVMIN) = -92 + randomized*2*(-1 + 2*rand(n));
            % Vrrp (transition from ERP to RRP when V(i,j) <= Vrrp)
            params(:,:,obj.ixVRRP) = 0.8*params(:,:,obj.ixVTH);
            % APDmax
            params(:,:,obj.ixAPDMAX) = 600 + randomized*10*(-1 + 2*rand(n));
            % APDmin
            params(:,:,obj.ixAPDMIN) = 0.5*params(:,:,obj.ixAPDMAX);
            % dmin = min upstroke slope
            params(:,:,obj.ixUPSTROKE_SLOPE_MIN) = 0.5*params(:,:,obj.ixUPSTROKE_SLOPE);
            % dmax = max upstroke velocity. When initializes, starts at max
            % upstroke slope
            params(:,:,obj.ixUPSTROKE_SLOPE_MAX) = params(:,:,obj.ixUPSTROKE_SLOPE);