Copy and paste your code from the Module 6 Matlab exercise here. It should look something like this:
```
%%%%%%%%%%%%%%%%submit this section of code to the Synapse page%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
```
> **Note:** if you put 3 back-ticks ( ``` ) above and below your pasted code, Synapse will format the post a bit more nicely for you!
Brian and James will check out what you did and provide feedback soon!
Created by James Eddy jaeddy Your code looks great Ruth and Edwin. We hope that you found the activity worthwhile and stimulating!
for i = 2:numSteps %define the space over which to simulate
for n = 1:clutchNum %loop over each individual clutch
if clutchState(n) == 0% !! clutch is unbound
pBind = 1-exp(-clutchOn*timeStep);% !! probability of binding within the given time step
temp = rand; % !! generate random number
if temp <= pBind %determine if the event is executed or not
clutchState(n) = 1; % !! clutch is now bound
end
elseif clutchState(n) == 1 % !! clutch is bound
%% unbinding rate is now depending on the loading force
clutchOff_prime = clutchOff*exp(clutchForce(n)/bondForce); % !! from Eq. 7, calculate the loaded dissociation rate
pUnbind = 1-exp(-clutchOff_prime*timeStep); % new probability of unbinding within the given time step
temp = rand; % !! generate random number
if temp <= pUnbind % !! determine if the event is executed or not
clutchState(n) = 0; % !! clutch is now unbound
end
end
end
csArray(i) = sum(clutchState); %record the total number of bound clutches
%balance the forces to determine the substrate position
sumClutchPos = sum(clutchPos(clutchState==1)); %summation from numerator of Eq. 5, do not change (note: this is only the summation, not complete numerator)
subPos(i) = (clutchKs*sumClutchPos)/(subKs+(csArray(i)*clutchKs)); % !! from Eq. 5, solve for the substrate position
%% solve for the actin flow rate based on the load
Fstall = motorNum*motorForce; % from Eq. 10, calculate the total stall force
actinFlow(i) = motorVel*(1-((subKs*subPos(i))/Fstall)); % !! from Eq. 9, determine the actin flow rate
%% forces have been added. loop through each clutch, update position and calculate force
for n = 1:clutchNum
if clutchState(n) == 0% !! clutch is unbound
clutchPos(n) = subPos(i); %unbound clutches are set at the substrate position
clutchForce(n) = (clutchPos(n)-subPos(i)); % !! from Eq. 8, determine the force on the individual clutch
elseif clutchState(n) == 1 % !! clutch is bound
clutchPos(n) = clutchPos(n) + actinFlow(i)*timeStep; % !! position moves at velocity of actin flow
clutchForce(n) = clutchKs*(clutchPos(n)-subPos(i)); % !! from Eq. 8, determine the force on the individual clutch
end
end
timeArray(i) = timeArray(i-1)+timeStep; %record the current time
end %%%%%%%%%%%%%%%%submit this section of code to the Synapse page%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i = 2:numSteps %define the space over which to simulate
for n = 1:clutchNum %loop over each individual clutch
if clutchState(n) == 0% !! clutch is unbound
pBind = 1-exp(-clutchOn*timeStep);% !! probability of binding within the given time step
temp = rand; % !! generate random number
if temp <= pBind %determine if the event is executed or not
clutchState(n) = 1; % !! clutch is now bound
end
elseif clutchState(n) == 1% !! clutch is bound
%% unbinding rate is now depending on the loading force
clutchOff_prime = clutchOff*exp(clutchForce(n)/bondForce); % !! from Eq. 7, calculate the loaded dissociation rate
pUnbind = 1-exp(-clutchOff_prime*timeStep); % new probability of unbinding within the given time step
temp = rand; % !! generate random number
if temp <= pUnbind % !! determine if the event is executed or not
clutchState(n) = 0; % !! clutch is now unbound
end
end
end
csArray(i) = sum(clutchState); %record the total number of bound clutches
%balance the forces to determine the substrate position
sumClutchPos = sum(clutchPos(clutchState==1)); %summation from numerator of Eq. 5, do not change (note: this is only the summation, not complete numerator)
subPos(i) = (clutchKs*sumClutchPos)/(subKs+(csArray(i)*clutchKs)); % !! from Eq. 5, solve for the substrate position
%% solve for the actin flow rate based on the load
Fstall = motorNum*motorForce; % from Eq. 10, calculate the total stall force
actinFlow(i) = motorVel*(1-((subKs*subPos(i))/Fstall)); % !! from Eq. 9, determine the actin flow rate
%% forces have been added. loop through each clutch, update position and calculate force
for n = 1:clutchNum
if clutchState(n) == 0 % !! clutch is unbound
clutchPos(n) = subPos(i); %unbound clutches are set at the substrate position
clutchForce(n) = clutchKs*(clutchPos(n)-subPos(i)); % !! from Eq. 8, determine the force on the individual clutch
elseif clutchState(n) == 1% !! clutch is bound
clutchPos(n) = clutchPos(n)+actinFlow(i)*timeStep; % !! position moves at velocity of actin flow
clutchForce(n) = clutchKs*(clutchPos(n)-subPos(i)); % !! from Eq. 8, determine the force on the individual clutch
end
end
timeArray(i) = timeArray(i-1)+timeStep; %record the current time
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%