Difference between revisions of "Team:Dundee/Modeling/Appendix3"

Line 253: Line 253:
  
 
  <span class="comment"><b><font size='6' color='green'>MATLAB code from run_chromate.m file</b></font></span>
 
  <span class="comment"><b><font size='6' color='green'>MATLAB code from run_chromate.m file</b></font></span>
 +
<span class="comment"><b>%% File to solve chromate functions.</b></span>
 +
<span class="comment"><b>%% Section 1: Solving the modified system to investigate GFP production with chromate added and removed at specific times.</b></span>
 +
<span class="comment">% a = Initial ChrB protein concentration.</span>
 +
a = 1;
 +
<span class="comment">% b = Initial ChrB dimer concentration.</span>
 +
b = 1;
 +
<span class="comment">% c = Initial Cv, chromate, concentration.</span>
 +
c =1;
 +
<span class="comment">% d = Initial Cv and dimer complex concentration.</span>
 +
d = 0;
 +
<span class="comment">% e = Initial Pc, closed promoter, concentration.</span>
 +
e = 0;
 +
<span class="comment">% f = Initial Po, open promoter, concentration.</span>
 +
f = 1;
 +
<span class="comment">% g = Initial GFP concentration.</span>
 +
g = 0.01;
 +
<span class="comment">% T = Final time of simulation, in seconds.</span>
 +
T=3600;
 +
<span class="comment">% Solve the function using ode23 solver with set time range and defined initial conditions.</span>
 +
<span class="comment">% Save time values in vector t and u(1)..u(7) values in matrix u.</span>
 +
[t,u]=ode23(@chromate,[0,T],[a,b,c,d,e,f,g],[]);
 +
 +
<span class="comment">% Call up empty figure 1 to prevent overwriting figures.</span>
 +
figure1=figure(1)
 +
<span class="comment">% Plot t vector against the 7th column of the u matrix, that is the GFP concentration, and set linewidth to 3 so that it is easily read.</span>
 +
plot(t,u(:,7), <span class="string">'LineWidth'</span>,3);
 +
<span class="comment">% Ensure that axis fits the data by using axis tight command.</span>
 +
axis <span class="string">tight</span>
 +
<span class="comment">% Remove the values on the x and y axis as they are not relevant.</span>
 +
set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]);
 +
<span class="comment">% Annotate the figure by adding arrows along the x and y axis to represent increasing time and concentration.</span>
 +
annotation(figure1,<span class="string">'arrow'</span>,[0.133928571428571 0.914285714285714],<span class="keyword">...</span>
 +
    [0.0466190476190482 0.0476190476190482],<span class="string">'LineWidth'</span>,4);
 +
annotation(figure1,<span class="string">'arrow'</span>,[0.0982142857142857 0.0982142857142857],<span class="keyword">...</span>
 +
    [0.103761904761905 0.919047619047619],<span class="string">'LineWidth'</span>,4);
 +
<span class="comment">% Annotate the figure by adding text arrow to highlight where the chromate is added and removed.</span>
 +
annotation(figure1,<span class="string">'textarrow'</span>,[0.3875 0.25],<span class="keyword">...</span>
 +
    [0.346619047619048 0.119047619047619],<span class="string">'Color'</span>,[1 0 0],<span class="keyword">...</span>
 +
    <span class="string">'String'</span>,{<span class="string">'Chromate Added'</span>},<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,4,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
annotation(figure1,<span class="string">'textarrow'</span>,[0.682142857142857 0.789285714285714],<span class="keyword">...</span>
 +
    [0.779952380952381 0.919047619047619],<span class="string">'Color'</span>,[1 0 0],<span class="keyword">...</span>
 +
    <span class="string">'String'</span>,{<span class="string">'Chromate Removed'</span>},<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,4,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
<span class="comment">% Set the labels of the x and y axis to Time and Concentration, respectively.</span>
 +
xlabel (<span class="string">'Increasing Time'</span>, <span class="string">'FontSize'</span>, 15);
 +
ylabel (<span class="string">'Increasing Concentration'</span>,<span class="string">'FontSize'</span>, 15);
 +
<span class="comment">% Add a legend for GFP Concentration.</span>
 +
legend1=legend(<span class="string">'GFP Concentration'</span>);
 +
<span class="comment">% Make the box around legend bold and make font bigger, also position legend so that it is easily read.</span>
 +
set(legend1,<span class="keyword">...</span>
 +
    <span class="string">'Position'</span>,[0.468154768530456 0.149603206588803 0.360714277944395 0.0626984112082966],<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,2,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
<span class="comment">% END OF SECTION</span>
 +
<span class="comment">%</span>
 +
<span class="comment">%</span>
 +
 +
<span class="comment"><b>%% Section 2: Sensitivity analysis on effect of chromate added to GFP production in modified pathway.</b></span>
 +
<span class="comment">% n = Number of different values of chromate evaluated.</span>
 +
n=10;
 +
<span class="comment">% T = Final time of simulation, in seconds.</span>
 +
T=3600;
 +
<span class="comment">% c1 = The range of values used for initial chromate concentration, with minimum at 0 and maximum at 400.</span>
 +
c1=linspace(0,400,n);
 +
<span class="comment">% Call up figure 2 to ensure no figures are overwritten.</span>
 +
figure2=figure(2)
 +
<span class="comment">% Set hold on so that multiple lines will be plotted on same figure.</span>
 +
hold <span class="string">on</span>
 +
<span class="comment">% Set a for loop so that the n values for chromate are evaluated individually and the system solved for each of them.</span>
 +
<span class="keyword">for</span> i=1:n
 +
<span class="comment">% Solve the chromate function using ode23 solver over set time range and same initial conditions for all variables except chromate.</span>
 +
    <span class="comment">% The initial concentration of chromate will depend on the value of i within the for loop.</span>
 +
    <span class="comment">% The values will be stored in the t vector and u matrix.</span>
 +
    [t,u]=ode23(@chromate,[0,T],[a,b,c1(i),d,e,f,g],[]);
 +
    <span class="comment">% Plot the GFP concentration over time.</span>
 +
    plot(t,u(:,7), <span class="string">'LineWidth'</span>,2);
 +
<span class="comment">% End the for loop.</span>
 +
<span class="keyword">end</span>
 +
<span class="comment">% Then switch hold off so that no more lines are plotted on figure.</span>
 +
hold <span class="string">off</span>
 +
<span class="comment">% Set axis to tight so that plot fits the data.</span>
 +
axis <span class="string">tight</span>
 +
<span class="comment">% Add a rectangle onto the graph to highlight the section that will be zoomed in on in figure 3.</span>
 +
annotation(<span class="string">'rectangle'</span>,[0.236714285714286 0.561904761904762 0.213285714285714 0.354761904761906], <span class="string">'LineStyle'</span>,<span class="string">'--'</span>);
 +
<span class="comment">% Remove the values of the x and y axis as they are not necessary.</span>
 +
set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]);
 +
<span class="comment">% Annotate the figure by adding arrows along the x and y axis to represent increasing time and concentration.</span>
 +
annotation(figure2,<span class="string">'arrow'</span>,[0.133928571428571 0.914285714285714],<span class="keyword">...</span>
 +
    [0.0466190476190482 0.0476190476190482],<span class="string">'LineWidth'</span>,4);
 +
annotation(figure2,<span class="string">'arrow'</span>,[0.0982142857142857 0.0982142857142857],<span class="keyword">...</span>
 +
    [0.103761904761905 0.919047619047619],<span class="string">'LineWidth'</span>,4);
 +
<span class="comment">% Annotate the figure by adding text arrow to highlight where the chromate is added and removed.</span>
 +
annotation(figure2,<span class="string">'textarrow'</span>,[0.3875 0.25],<span class="keyword">...</span>
 +
    [0.346619047619048 0.119047619047619],<span class="string">'Color'</span>,[1 0 0],<span class="keyword">...</span>
 +
    <span class="string">'String'</span>,{<span class="string">'Chromate Added'</span>},<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,4,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
annotation(figure2,<span class="string">'textarrow'</span>,[0.682142857142857 0.789285714285714],<span class="keyword">...</span>
 +
    [0.779952380952381 0.919047619047619],<span class="string">'Color'</span>,[1 0 0],<span class="keyword">...</span>
 +
    <span class="string">'String'</span>,{<span class="string">'Chromate Removed'</span>},<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,4,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
<span class="comment">% Set the labels of the x and y axis to Time and Concentration, respectively.</span>
 +
xlabel (<span class="string">'Increasing Time'</span>, <span class="string">'FontSize'</span>, 15);
 +
ylabel (<span class="string">'Increasing Concentration'</span>,<span class="string">'FontSize'</span>, 15);
 +
<span class="comment">%</span>
 +
<span class="comment"><b>% We will now replot figure 2 but zoom in on a specific section for clarity.</b></span>
 +
<span class="comment">%</span>
 +
<span class="comment">%</span>
 +
<span class="comment">% Call up empty figure 3 to prevent overwriting figures.</span>
 +
figure3=figure(3)
 +
<span class="comment">% Set hold on so that multiple lines will be plotted on same figure.</span>
 +
hold <span class="string">on</span>
 +
<span class="comment">% Set a for loop so that the n values for chromate are evaluated individually and the system solved for each of them.</span>
 +
<span class="keyword">for</span> i=1:n
 +
<span class="comment">% Solve the chromate function using ode23 solver over set time range and same initial conditions for all variables except chromate.</span>
 +
 
 +
    <span class="comment">% The initial concentration of chromate will depend on the value of i within the for loop.</span>
 +
    <span class="comment">% The values will be stored in the t vector and u matrix.</span>
 +
    [t,u]=ode23(@chromate,[0,T],[a,b,c1(i),d,e,f,g],[]);
 +
    <span class="comment">% Plot the GFP concentration over time.</span>
 +
    plot(t,u(:,7), <span class="string">'LineWidth'</span>,2);
 +
<span class="comment">% End the for loop.</span>
 +
<span class="keyword">end</span>
 +
<span class="comment">% set hold off, so that no more lines are plotted.</span>
 +
hold <span class="string">off</span>
 +
<span class="comment">% Ensure that axis fits the data by using axis tight command.</span>
 +
axis <span class="string">tight</span>
 +
<span class="comment">% Remove the values on the x and y axis as they are not relevant and set the x and y limits so that we get a zoomed in section of the plot.</span>
 +
set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[], <span class="string">'XLim'</span>,[909.850230414748 1359.85023041475],<span class="string">'YLim'</span>,[163.478891218168 187.138947135872]);
 +
<span class="comment">% Annotate the figure by adding arrows along the x and y axis to represent increasing time and concentration.</span>
 +
annotation(figure3,<span class="string">'arrow'</span>,[0.133928571428571 0.914285714285714],<span class="keyword">...</span>
 +
    [0.0466190476190482 0.0476190476190482],<span class="string">'LineWidth'</span>,4);
 +
annotation(figure3,<span class="string">'arrow'</span>,[0.0982142857142857 0.0982142857142857],<span class="keyword">...</span>
 +
    [0.103761904761905 0.919047619047619],<span class="string">'LineWidth'</span>,4);
 +
<span class="comment">% Add a 3rd arrow to the plot to show increasing initial concentration of Cv in the legend.</span>
 +
annotation(figure3,<span class="string">'arrow'</span>,[0.817857142857141 0.817857142857143],<span class="keyword">...</span>
 +
    [0.597619047619051 0.238095238095238],<span class="string">'LineWidth'</span>,4);
 +
<span class="comment">% Set legend as just lines with no text, as text will be added later using paint (see wiki figures).</span>
 +
legend2=legend(<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>);
 +
<span class="comment">% Set the position of the legend and the width of the box line.</span>
 +
set(legend2,<span class="keyword">...</span>
 +
    <span class="string">'Position'</span>,[0.631547602609266 0.207142857142858 0.255952397390734 0.413492042689934],<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,2);
 +
<span class="comment">% Set the labels of the x and y axis to Time and Concentration, respectively.</span>
 +
xlabel (<span class="string">'Increasing Time'</span>, <span class="string">'FontSize'</span>, 15);
 +
ylabel (<span class="string">'Increasing Concentration'</span>,<span class="string">'FontSize'</span>, 15);
 +
<span class="comment">% END OF SECTION</span>
 +
<span class="comment">%</span>
 +
<span class="comment">%</span>
 +
 +
 +
 +
<span class="comment"><b>%% Section 3: Solving the original system to investigate GFP production with chromate added and removed at specific times.</b></span>
 +
<span class="comment">% The same initial conditions are used as modified systems so they do not need to be redefined.</span>
 +
<span class="comment">% Solve the chrom_wt function using ode23 solver with set time range and defined initial conditions.</span>
 +
<span class="comment">% Save time values in vector t and u(1)..u1(7) values in matrix u.</span>
 +
[t,u]=ode23(@chrom_wt,[0,T],[a,b,c,d,e,f,g],[]);
 +
<span class="comment">% Call up a new figure to ensure figures are not overwritten.</span>
 +
figure4=figure(4)
 +
<span class="comment">% Plot t vector against the 7th column of the u matrix, that is the GFP</span>
 +
<span class="comment">% concentration, and set linewidth to 3 so that it is easily read.</span>
 +
plot(t,u(:,7), <span class="string">'LineWidth'</span>,3);
 +
<span class="comment">% Ensure that axis fits the data by using axis tight command.</span>
 +
axis <span class="string">tight</span>
 +
<span class="comment">% Remove the values on the x and y axis as they are not relevant.</span>
 +
set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]);
 +
<span class="comment">% Annotate the figure by adding arrows along the x and y axis to represent</span>
 +
<span class="comment">% increasing time and concentration.</span>
 +
annotation(figure4,<span class="string">'arrow'</span>,[0.133928571428571 0.914285714285714],<span class="keyword">...</span>
 +
    [0.0466190476190482 0.0476190476190482],<span class="string">'LineWidth'</span>,4);
 +
annotation(figure4,<span class="string">'arrow'</span>,[0.0982142857142857 0.0982142857142857],<span class="keyword">...</span>
 +
    [0.103761904761905 0.919047619047619],<span class="string">'LineWidth'</span>,4);
 +
<span class="comment">% Annotate the figure by adding text arrow to highlight where the chromate</span>
 +
<span class="comment">% is added and removed.</span>
 +
annotation(figure4,<span class="string">'textarrow'</span>,[0.3875 0.25],<span class="keyword">...</span>
 +
    [0.346619047619048 0.119047619047619],<span class="string">'Color'</span>,[1 0 0],<span class="keyword">...</span>
 +
    <span class="string">'String'</span>,{<span class="string">'Chromate Added'</span>},<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,4,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
annotation(figure4,<span class="string">'textarrow'</span>,[0.682142857142857 0.789285714285714],<span class="keyword">...</span>
 +
    [0.779952380952381 0.919047619047619],<span class="string">'Color'</span>,[1 0 0],<span class="keyword">...</span>
 +
    <span class="string">'String'</span>,{<span class="string">'Chromate Removed'</span>},<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,4,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
<span class="comment">% Set the x and y labels to Increasing Time and Increasing concentration.</span>
 +
xlabel (<span class="string">'Increasing Time'</span>, <span class="string">'FontSize'</span>, 15);
 +
ylabel (<span class="string">'Increasing Concentration'</span>,<span class="string">'FontSize'</span>, 15);
 +
<span class="comment">% Add a legend for GFP Concentration.</span>
 +
legend3=legend(<span class="string">'GFP Concentration'</span>);
 +
<span class="comment">% Set the legend position, box line width and font size/style.</span>
 +
set(legend3,<span class="keyword">...</span>
 +
    <span class="string">'Position'</span>,[0.468154768530456 0.149603206588803 0.360714277944395 0.0626984112082966],<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,2,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
<span class="comment">% END OF SECTION</span>
 +
<span class="comment">%</span>
 +
<span class="comment">%</span>
 +
</pre><pre class="codeoutput">figure4 =
 +
 +
  Figure (4) with properties:
 +
 +
      Number: 4
 +
        Name: ''
 +
      Color: [0.9400 0.9400 0.9400]
 +
    Position: [403 246 560 420]
 +
      Units: 'pixels'
 +
 +
  Use GET to show all properties
 +
 +
</pre><img vspace="5" hspace="5" src="run_chromate_04.png" alt=""> <h2>Section 4: Sensitivity analysis on effect of chromate added to GFP production in original pathway.<a name="4"></a></h2><p>Again set n as the number of values used for initial chromate.</p><pre class="codeinput">n=10;
 +
<span class="comment">% T = Final time of simulation, in seconds.</span>
 +
T=3600;
 +
<span class="comment">% c1 = The range of values used for initial chromate concentration, with</span>
 +
<span class="comment">% minimum at 0 and maximum at 400.</span>
 +
c1=linspace(0,400,n);
 +
<span class="comment">% Call up figure 5 to ensure no figures are overwritten.</span>
 +
figure5=figure(5)
 +
<span class="comment">% Set hold on so that multiple lines will be plotted on same figure.</span>
 +
hold <span class="string">on</span>
 +
<span class="comment">% Set a for loop so that the n values for chromate are evaluated</span>
 +
<span class="comment">% individually and the system solved for each of them.</span>
 +
<span class="keyword">for</span> i=1:n
 +
<span class="comment">% Solve the chromate function using ode23 solver over set time range</span>
 +
    <span class="comment">% and same initial conditions for all variables except chromate.</span>
 +
    <span class="comment">% The initial concentration of chromate will depend on the value of i</span>
 +
    <span class="comment">% within the for loop.</span>
 +
    <span class="comment">% The values will be stored in the t vector and u matrix.</span>
 +
    [t,u]=ode23(@chrom_wt,[0,T],[a,b,c1(i),d,e,f,g],[]);
 +
    <span class="comment">% Plot the GFP concentration over time.</span>
 +
    plot(t,u(:,7), <span class="string">'LineWidth'</span>,2);
 +
<span class="comment">% End the for loop.</span>
 +
<span class="keyword">end</span>
 +
<span class="comment">% Then switch hold off so that no more lines are plotted on figure.</span>
 +
hold <span class="string">off</span>
 +
<span class="comment">% Set the axis to tight so that the data fits the plot.</span>
 +
axis <span class="string">tight</span>
 +
<span class="comment">% Add a rectangle onto the graph to highlight the section that will be</span>
 +
<span class="comment">% zoomed in on in figure 6.</span>
 +
annotation(<span class="string">'rectangle'</span>,[0.236714285714286 0.561904761904762 0.213285714285714 0.354761904761906], <span class="string">'LineStyle'</span>, <span class="string">'--'</span>);
 +
<span class="comment">% Remove the values on the x and y axis as they are not relevant.</span>
 +
set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[]);
 +
<span class="comment">% Annotate the figure by adding arrows along the x and y axis to represent</span>
 +
<span class="comment">% increasing time and concentration.</span>
 +
annotation(figure5,<span class="string">'arrow'</span>,[0.133928571428571 0.914285714285714],<span class="keyword">...</span>
 +
    [0.0466190476190482 0.0476190476190482],<span class="string">'LineWidth'</span>,4);
 +
annotation(figure5,<span class="string">'arrow'</span>,[0.0982142857142857 0.0982142857142857],<span class="keyword">...</span>
 +
    [0.103761904761905 0.919047619047619],<span class="string">'LineWidth'</span>,4);
 +
<span class="comment">% Annotate the figure by adding text arrow to highlight where the chromate</span>
 +
<span class="comment">% is added and removed.</span>
 +
annotation(figure5,<span class="string">'textarrow'</span>,[0.3875 0.25],<span class="keyword">...</span>
 +
    [0.346619047619048 0.119047619047619],<span class="string">'Color'</span>,[1 0 0],<span class="keyword">...</span>
 +
    <span class="string">'String'</span>,{<span class="string">'Chromate Added'</span>},<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,4,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
annotation(figure5,<span class="string">'textarrow'</span>,[0.682142857142857 0.789285714285714],<span class="keyword">...</span>
 +
    [0.779952380952381 0.919047619047619],<span class="string">'Color'</span>,[1 0 0],<span class="keyword">...</span>
 +
    <span class="string">'String'</span>,{<span class="string">'Chromate Removed'</span>},<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,4,<span class="keyword">...</span>
 +
    <span class="string">'FontWeight'</span>,<span class="string">'bold'</span>,<span class="keyword">...</span>
 +
    <span class="string">'FontSize'</span>,12);
 +
<span class="comment">% Set the x and y labels as increasing Time and Increasing Concentration</span>
 +
<span class="comment">% respectively.</span>
 +
xlabel (<span class="string">'Increasing Time'</span>, <span class="string">'FontSize'</span>, 15);
 +
ylabel (<span class="string">'Increasing Concentration'</span>,<span class="string">'FontSize'</span>, 15);
 +
<span class="comment">%</span>
 +
<span class="comment">% We now want to replot figure 5 with a section zoomed in.</span>
 +
<span class="comment">%</span>
 +
<span class="comment">% Call up figure 6 so that no other plots are overwritten.</span>
 +
figure6=figure(6)
 +
<span class="comment">% Set hold on so that multiple line can be plotted on one graph.</span>
 +
hold <span class="string">on</span>
 +
<span class="comment">% Set a for loop so that the n values for chromate are evaluated</span>
 +
<span class="comment">% individually and the system solved for each of them.</span>
 +
<span class="keyword">for</span> i=1:n
 +
<span class="comment">% Solve the chromate function using ode23 solver over set time range</span>
 +
    <span class="comment">% and same initial conditions for all variables except chromate.</span>
 +
    <span class="comment">% The initial concentration of chromate will depend on the value of i</span>
 +
    <span class="comment">% within the for loop.</span>
 +
    <span class="comment">% The values will be stored in the t vector and u matrix.</span>
 +
    [t,u]=ode23(@chrom_wt,[0,T],[a,b,c1(i),d,e,f,g],[]);
 +
    <span class="comment">% Plot the GFP concentration over time.</span>
 +
    plot(t,u(:,7), <span class="string">'LineWidth'</span>,2);
 +
<span class="comment">% End the for loop.</span>
 +
<span class="keyword">end</span>
 +
<span class="comment">% Set hold off so that no more lines are plotted on the figure.</span>
 +
hold <span class="string">off</span>
 +
<span class="comment">% Ensure that axis fits the data by using axis tight command.</span>
 +
axis <span class="string">tight</span>
 +
<span class="comment">% Remove the values on the x and y axis as they are not relevant and set the x and y limits so that we get a zoomed in section of the plot.</span>
 +
set(gca,<span class="string">'YTick'</span>,[],<span class="string">'XTick'</span>,[], <span class="string">'XLim'</span>,[909.850230414748 1359.85023041475],<span class="string">'YLim'</span>,[163.478891218168 187.138947135872]);
 +
<span class="comment">% Annotate the figure by adding arrows along the x and y axis to represent</span>
 +
<span class="comment">% increasing time and concentration.</span>
 +
annotation(figure6,<span class="string">'arrow'</span>,[0.133928571428571 0.914285714285714],<span class="keyword">...</span>
 +
    [0.0466190476190482 0.0476190476190482],<span class="string">'LineWidth'</span>,4);
 +
annotation(figure6,<span class="string">'arrow'</span>,[0.0982142857142857 0.0982142857142857],<span class="keyword">...</span>
 +
    [0.103761904761905 0.919047619047619],<span class="string">'LineWidth'</span>,4);
 +
<span class="comment">% Add a 3rd arrow to the plot to show increasing initial concentration of</span>
 +
<span class="comment">% Cv in the legend.</span>
 +
annotation(figure6,<span class="string">'arrow'</span>,[0.817857142857141 0.817857142857143],<span class="keyword">...</span>
 +
    [0.597619047619051 0.238095238095238],<span class="string">'LineWidth'</span>,4);
 +
<span class="comment">% Set legend as just lines with no text, as text will be added later using</span>
 +
<span class="comment">% paint (see wiki figures).</span>
 +
legend4=legend(<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>,<span class="string">''</span>);
 +
<span class="comment">% Set the position of the legend and the width of the box line.</span>
 +
set(legend4,<span class="keyword">...</span>
 +
    <span class="string">'Position'</span>,[0.631547602609266 0.207142857142858 0.255952397390734 0.413492042689934],<span class="keyword">...</span>
 +
    <span class="string">'LineWidth'</span>,2);
 +
<span class="comment">% Set the x and y labels to Increasing Time and Increasing Concentration</span>
 +
<span class="comment">% respectively.</span>
 +
xlabel (<span class="string">'Increasing Time'</span>, <span class="string">'FontSize'</span>, 15);
 +
ylabel (<span class="string">'Increasing Concentration'</span>,<span class="string">'FontSize'</span>, 15);
 +
<span class="comment">%</span>
 +
<span class="comment">%</span>
 +
<span class="comment">% END OF FILE</span>
 +
</pre>
 
</pre>
 
</pre>
 
</div>
 
</div>

Revision as of 17:15, 20 August 2015

Dry Lab

Appendix 3: Chromate Biosensor Code

Chromate Model Code

MATLAB code for chromate model.

Bone Incision Experimental Data

Raw data for the bone incision experiments.

Bone Incision Experiment Code

MATLAB code for the bone incision experiments.

Chromate Model Code

The figures shown in the chromate detector model were created using MATLAB. Two files were written to perform sensitivity analysis; one to set the function (chromate.m) and one to solve the function and plot the results in figures Figure 3, Figure 4 and Figure 5 (run_chromate.m). Both files are shown below, where the green is comments to aid in understanding of the scripts.


  MATLAB code from chromate.m file
% Function to define the system of ODEs describing the modified chromate pathway.
%% Section 1: Function to define the system of ODEs describing the modified chromate pathway.
% The vector u has seven dimensions where;
% u(1) = ChrB protein concentration,
% u(2) = ChrB dimer concentration,
% u(3) = Cv, the hexavalent chromate added to the system concentration,
% u(4) = Dimer and Cv complex concentration,
% u(5) = Pc, the closed (bound and non-functioning) promoter concentration,
% u(6) = Po. the open (unbound and functioning) promoter concentration,
% u(7) = GFP output concentration.
% Parameter t is time that the simulation runs over. 
% Parameters k1..k8 represent the kinetic rates of the system.
function f=chromate(t,u);
k1 = 1;
k2 = 1;
k3 = 1;
km3 = 1;
k4 = 1;
km4 = 1;
k5 = 1;
k6 = 1;
km6=1;
k7 = 1;
% k8 divided by 60 as in minutes not hours.
k8=(0.25/60);
% Set S1 and S2 at specific times which represent whether chromate is present or not
% S is the signal input.

S1=0;
S2=1;
if (t<500)% Where time is less than 500 seconds.
    S=S1;

else if (t>500) && (t<3100)% Where time is more than 500 seconds and less than 3100 seconds.
        S=S2;

    else if (t>3100)% Where time is more than 3100 seconds.
            S=S1;
        end
    end
end % If and else if loop sets the times when chromate is present or absent from the system.
% Define f as a vector where the input is the right hand side of the systems of ODEs representing the pathway with signal input incorporated.
f=[k1 - k2*u(1)+km3*u(2)-k3*u(1)*u(1);
    k3*u(1)*u(1)-km3*u(2)+(km4*u(4))-(k4*u(2)*u(3)*S)-k5*u(2)+(km6*u(5)*S)-k6*u(2)*u(6);
    -k4*u(2)*u(3)*S+km4*u(4);
     k4*u(2)*u(3)*S-km4*u(4);
     k6*u(6)*u(2)-km6*u(5)*S;
     -k6*u(6)*u(2)+km6*u(5)*S;
     k7*u(6)*S-k8*u(7)];
 % End function.
end
% This function can then be called using the @chromate command in run_chromate.m file.
% END OF SECTION
%
%
%% Function to define the system of ODEs describing the original chromate pathway.
% Function to define the system of ODEs describing the modified chromate pathway.
%% Section 1: Function to define the system of ODEs describing the modified chromate pathway.
% The vector u has seven dimensions where;
% u(1) = ChrB protein concentration,
% u(2) = ChrB dimer concentration,
% u(3) = Cv, the hexavalent chromate added to the system concentration,
% u(4) = Dimer and Cv complex concentration,
% u(5) = Pc, the closed (bound and non-functioning) promoter concentration,
% u(6) = Po. the open (unbound and functioning) promoter concentration,
% u(7) = GFP output concentration.
% Parameter t is time that the simulation runs over. 
% Parameters k1..k8 represent the kinetic rates of the system.
function f=chrom_wt(t1,u1);
k2 = 1;
k3 = 1;
km3 = 1;
k4 = 1;
km4 = 1;
k5 = 1;
k6 = 1;
km6=1;
k7 = 1;
% k8 divided by 60 as in minutes not hours.
k8=(0.25/60);
% Set S1 and S2 at specific times which represent whether chromate is present or not.
% S is the signal input.

S1=0;
S2=1;
if (t1<500)% Where time is less than 500 seconds.
    S=S1;

else if (t1>500) && (t1<3100)% Where time is more than 500 seconds and less than 3100 seconds.
        S=S2;

    else if (t1>3100)% Where time is more than 3100 seconds.
            S=S1;
        end
    end
end % If and else if loop sets the times when chromate is present or absent from the system.
% Define f as a vector where the input is the right hand side of the systems of ODEs representing the pathway with signal input incorporated.
f=[k7*u1(6)-k2*u1(1)+km3*u1(2)-k3*u1(1)*u1(1);
    k3*u1(1)*u1(1)-km3*u1(2)+(km4*u1(4))-(k4*u1(2)*u1(3)*S)-k5*u1(2)+(km6*u1(5)*S)-k6*u1(2)*u1(6);
    -k4*u1(2)*u1(3)*S+km4*u1(4);
     k4*u1(2)*u1(3)*S-km4*u1(4);
     k6*u1(6)*u1(2)-km6*u1(5)*S;
     -k6*u1(6)*u1(2)+km6*u1(5)*S;
     k7*u1(6)*S-k8*u1(7)];
 % End function.
end
% This function can then be called using the @chrom_wt command in run_chromate.m file
%
%
% END OF FILE




 MATLAB code from run_chromate.m file
%% File to solve chromate functions.
%% Section 1: Solving the modified system to investigate GFP production with chromate added and removed at specific times.
% a = Initial ChrB protein concentration.
a = 1;
% b = Initial ChrB dimer concentration.
b = 1;
% c = Initial Cv, chromate, concentration.
c =1;
% d = Initial Cv and dimer complex concentration.
d = 0;
% e = Initial Pc, closed promoter, concentration.
e = 0;
% f = Initial Po, open promoter, concentration.
f = 1;
% g = Initial GFP concentration.
g = 0.01;
% T = Final time of simulation, in seconds.
T=3600;
% Solve the function using ode23 solver with set time range and defined initial conditions.
% Save time values in vector t and u(1)..u(7) values in matrix u.
[t,u]=ode23(@chromate,[0,T],[a,b,c,d,e,f,g],[]);

% Call up empty figure 1 to prevent overwriting figures.
figure1=figure(1)
% Plot t vector against the 7th column of the u matrix, that is the GFP concentration, and set linewidth to 3 so that it is easily read.
plot(t,u(:,7), 'LineWidth',3);
% Ensure that axis fits the data by using axis tight command.
axis tight
% Remove the values on the x and y axis as they are not relevant.
set(gca,'YTick',[],'XTick',[]);
% Annotate the figure by adding arrows along the x and y axis to represent increasing time and concentration.
annotation(figure1,'arrow',[0.133928571428571 0.914285714285714],...
    [0.0466190476190482 0.0476190476190482],'LineWidth',4);
annotation(figure1,'arrow',[0.0982142857142857 0.0982142857142857],...
    [0.103761904761905 0.919047619047619],'LineWidth',4);
% Annotate the figure by adding text arrow to highlight where the chromate is added and removed.
annotation(figure1,'textarrow',[0.3875 0.25],...
    [0.346619047619048 0.119047619047619],'Color',[1 0 0],...
    'String',{'Chromate Added'},...
    'LineWidth',4,...
    'FontWeight','bold',...
    'FontSize',12);
annotation(figure1,'textarrow',[0.682142857142857 0.789285714285714],...
    [0.779952380952381 0.919047619047619],'Color',[1 0 0],...
    'String',{'Chromate Removed'},...
    'LineWidth',4,...
    'FontWeight','bold',...
    'FontSize',12);
% Set the labels of the x and y axis to Time and Concentration, respectively.
xlabel ('Increasing Time', 'FontSize', 15);
ylabel ('Increasing Concentration','FontSize', 15);
% Add a legend for GFP Concentration.
legend1=legend('GFP Concentration');
% Make the box around legend bold and make font bigger, also position legend so that it is easily read.
set(legend1,...
    'Position',[0.468154768530456 0.149603206588803 0.360714277944395 0.0626984112082966],...
    'LineWidth',2,...
    'FontWeight','bold',...
    'FontSize',12);
% END OF SECTION
%
%

%% Section 2: Sensitivity analysis on effect of chromate added to GFP production in modified pathway.
% n = Number of different values of chromate evaluated.
n=10;
% T = Final time of simulation, in seconds.
T=3600;
% c1 = The range of values used for initial chromate concentration, with minimum at 0 and maximum at 400.
c1=linspace(0,400,n);
% Call up figure 2 to ensure no figures are overwritten.
figure2=figure(2)
% Set hold on so that multiple lines will be plotted on same figure.
hold on
% Set a for loop so that the n values for chromate are evaluated individually and the system solved for each of them.
for i=1:n
 % Solve the chromate function using ode23 solver over set time range and same initial conditions for all variables except chromate.
    % The initial concentration of chromate will depend on the value of i within the for loop.
    % The values will be stored in the t vector and u matrix.
    [t,u]=ode23(@chromate,[0,T],[a,b,c1(i),d,e,f,g],[]);
    % Plot the GFP concentration over time.
    plot(t,u(:,7), 'LineWidth',2);
% End the for loop.
end
% Then switch hold off so that no more lines are plotted on figure.
hold off
% Set axis to tight so that plot fits the data.
axis tight
% Add a rectangle onto the graph to highlight the section that will be zoomed in on in figure 3.
annotation('rectangle',[0.236714285714286 0.561904761904762 0.213285714285714 0.354761904761906], 'LineStyle','--');
% Remove the values of the x and y axis as they are not necessary.
set(gca,'YTick',[],'XTick',[]);
% Annotate the figure by adding arrows along the x and y axis to represent increasing time and concentration.
annotation(figure2,'arrow',[0.133928571428571 0.914285714285714],...
    [0.0466190476190482 0.0476190476190482],'LineWidth',4);
annotation(figure2,'arrow',[0.0982142857142857 0.0982142857142857],...
    [0.103761904761905 0.919047619047619],'LineWidth',4);
% Annotate the figure by adding text arrow to highlight where the chromate is added and removed.
annotation(figure2,'textarrow',[0.3875 0.25],...
    [0.346619047619048 0.119047619047619],'Color',[1 0 0],...
    'String',{'Chromate Added'},...
    'LineWidth',4,...
    'FontWeight','bold',...
    'FontSize',12);
annotation(figure2,'textarrow',[0.682142857142857 0.789285714285714],...
    [0.779952380952381 0.919047619047619],'Color',[1 0 0],...
    'String',{'Chromate Removed'},...
    'LineWidth',4,...
    'FontWeight','bold',...
    'FontSize',12);
% Set the labels of the x and y axis to Time and Concentration, respectively.
xlabel ('Increasing Time', 'FontSize', 15);
ylabel ('Increasing Concentration','FontSize', 15);
%
% We will now replot figure 2 but zoom in on a specific section for clarity.
%
%
% Call up empty figure 3 to prevent overwriting figures.
figure3=figure(3)
% Set hold on so that multiple lines will be plotted on same figure.
 hold on
 % Set a for loop so that the n values for chromate are evaluated individually and the system solved for each of them.
 for i=1:n
 % Solve the chromate function using ode23 solver over set time range and same initial conditions for all variables except chromate.
   
    % The initial concentration of chromate will depend on the value of i within the for loop.
    % The values will be stored in the t vector and u matrix.
    [t,u]=ode23(@chromate,[0,T],[a,b,c1(i),d,e,f,g],[]);
    % Plot the GFP concentration over time.
    plot(t,u(:,7), 'LineWidth',2);
% End the for loop.
 end
 % set hold off, so that no more lines are plotted.
hold off
% Ensure that axis fits the data by using axis tight command.
axis tight
% Remove the values on the x and y axis as they are not relevant and set the x and y limits so that we get a zoomed in section of the plot.
set(gca,'YTick',[],'XTick',[], 'XLim',[909.850230414748 1359.85023041475],'YLim',[163.478891218168 187.138947135872]);
% Annotate the figure by adding arrows along the x and y axis to represent increasing time and concentration.
annotation(figure3,'arrow',[0.133928571428571 0.914285714285714],...
    [0.0466190476190482 0.0476190476190482],'LineWidth',4);
annotation(figure3,'arrow',[0.0982142857142857 0.0982142857142857],...
    [0.103761904761905 0.919047619047619],'LineWidth',4);
% Add a 3rd arrow to the plot to show increasing initial concentration of Cv in the legend.
annotation(figure3,'arrow',[0.817857142857141 0.817857142857143],...
    [0.597619047619051 0.238095238095238],'LineWidth',4);
% Set legend as just lines with no text, as text will be added later using paint (see wiki figures).
legend2=legend('','','','','','','','','','');
% Set the position of the legend and the width of the box line.
set(legend2,...
    'Position',[0.631547602609266 0.207142857142858 0.255952397390734 0.413492042689934],...
    'LineWidth',2);
% Set the labels of the x and y axis to Time and Concentration, respectively.
xlabel ('Increasing Time', 'FontSize', 15);
ylabel ('Increasing Concentration','FontSize', 15);
% END OF SECTION
%
%



%% Section 3: Solving the original system to investigate GFP production with chromate added and removed at specific times.
% The same initial conditions are used as modified systems so they do not need to be redefined.
% Solve the chrom_wt function using ode23 solver with set time range and defined initial conditions.
% Save time values in vector t and u(1)..u1(7) values in matrix u.
[t,u]=ode23(@chrom_wt,[0,T],[a,b,c,d,e,f,g],[]);
% Call up a new figure to ensure figures are not overwritten.
figure4=figure(4)
% Plot t vector against the 7th column of the u matrix, that is the GFP
% concentration, and set linewidth to 3 so that it is easily read.
plot(t,u(:,7), 'LineWidth',3);
% Ensure that axis fits the data by using axis tight command.
axis tight
% Remove the values on the x and y axis as they are not relevant.
set(gca,'YTick',[],'XTick',[]);
% Annotate the figure by adding arrows along the x and y axis to represent
% increasing time and concentration.
annotation(figure4,'arrow',[0.133928571428571 0.914285714285714],...
    [0.0466190476190482 0.0476190476190482],'LineWidth',4);
annotation(figure4,'arrow',[0.0982142857142857 0.0982142857142857],...
    [0.103761904761905 0.919047619047619],'LineWidth',4);
% Annotate the figure by adding text arrow to highlight where the chromate
% is added and removed.
annotation(figure4,'textarrow',[0.3875 0.25],...
    [0.346619047619048 0.119047619047619],'Color',[1 0 0],...
    'String',{'Chromate Added'},...
    'LineWidth',4,...
    'FontWeight','bold',...
    'FontSize',12);
annotation(figure4,'textarrow',[0.682142857142857 0.789285714285714],...
    [0.779952380952381 0.919047619047619],'Color',[1 0 0],...
    'String',{'Chromate Removed'},...
    'LineWidth',4,...
    'FontWeight','bold',...
    'FontSize',12);
% Set the x and y labels to Increasing Time and Increasing concentration.
xlabel ('Increasing Time', 'FontSize', 15);
ylabel ('Increasing Concentration','FontSize', 15);
% Add a legend for GFP Concentration.
legend3=legend('GFP Concentration');
% Set the legend position, box line width and font size/style.
set(legend3,...
    'Position',[0.468154768530456 0.149603206588803 0.360714277944395 0.0626984112082966],...
    'LineWidth',2,...
    'FontWeight','bold',...
    'FontSize',12);
% END OF SECTION
%
%
figure4 = 

  Figure (4) with properties:

      Number: 4
        Name: ''
       Color: [0.9400 0.9400 0.9400]
    Position: [403 246 560 420]
       Units: 'pixels'

  Use GET to show all properties

Section 4: Sensitivity analysis on effect of chromate added to GFP production in original pathway.

Again set n as the number of values used for initial chromate.

n=10;
% T = Final time of simulation, in seconds.
T=3600;
% c1 = The range of values used for initial chromate concentration, with
% minimum at 0 and maximum at 400.
c1=linspace(0,400,n);
% Call up figure 5 to ensure no figures are overwritten.
figure5=figure(5)
% Set hold on so that multiple lines will be plotted on same figure.
hold on
% Set a for loop so that the n values for chromate are evaluated
% individually and the system solved for each of them.
for i=1:n
 % Solve the chromate function using ode23 solver over set time range
    % and same initial conditions for all variables except chromate.
    % The initial concentration of chromate will depend on the value of i
    % within the for loop.
    % The values will be stored in the t vector and u matrix.
    [t,u]=ode23(@chrom_wt,[0,T],[a,b,c1(i),d,e,f,g],[]);
    % Plot the GFP concentration over time.
    plot(t,u(:,7), 'LineWidth',2);
% End the for loop.
end
% Then switch hold off so that no more lines are plotted on figure.
hold off
% Set the axis to tight so that the data fits the plot.
axis tight
% Add a rectangle onto the graph to highlight the section that will be
% zoomed in on in figure 6.
annotation('rectangle',[0.236714285714286 0.561904761904762 0.213285714285714 0.354761904761906], 'LineStyle', '--');
% Remove the values on the x and y axis as they are not relevant.
set(gca,'YTick',[],'XTick',[]);
% Annotate the figure by adding arrows along the x and y axis to represent
% increasing time and concentration.
annotation(figure5,'arrow',[0.133928571428571 0.914285714285714],...
    [0.0466190476190482 0.0476190476190482],'LineWidth',4);
annotation(figure5,'arrow',[0.0982142857142857 0.0982142857142857],...
    [0.103761904761905 0.919047619047619],'LineWidth',4);
% Annotate the figure by adding text arrow to highlight where the chromate
% is added and removed.
annotation(figure5,'textarrow',[0.3875 0.25],...
    [0.346619047619048 0.119047619047619],'Color',[1 0 0],...
    'String',{'Chromate Added'},...
    'LineWidth',4,...
    'FontWeight','bold',...
    'FontSize',12);
annotation(figure5,'textarrow',[0.682142857142857 0.789285714285714],...
    [0.779952380952381 0.919047619047619],'Color',[1 0 0],...
    'String',{'Chromate Removed'},...
    'LineWidth',4,...
    'FontWeight','bold',...
    'FontSize',12);
% Set the x and y labels as increasing Time and Increasing Concentration
% respectively.
xlabel ('Increasing Time', 'FontSize', 15);
ylabel ('Increasing Concentration','FontSize', 15);
%
% We now want to replot figure 5 with a section zoomed in.
%
% Call up figure 6 so that no other plots are overwritten.
figure6=figure(6)
% Set hold on so that multiple line can be plotted on one graph.
 hold on
 % Set a for loop so that the n values for chromate are evaluated
% individually and the system solved for each of them.
 for i=1:n
 % Solve the chromate function using ode23 solver over set time range
    % and same initial conditions for all variables except chromate.
    % The initial concentration of chromate will depend on the value of i
    % within the for loop.
    % The values will be stored in the t vector and u matrix.
    [t,u]=ode23(@chrom_wt,[0,T],[a,b,c1(i),d,e,f,g],[]);
    % Plot the GFP concentration over time.
    plot(t,u(:,7), 'LineWidth',2);
% End the for loop.
 end
 % Set hold off so that no more lines are plotted on the figure.
hold off
% Ensure that axis fits the data by using axis tight command.
axis tight
% Remove the values on the x and y axis as they are not relevant and set the x and y limits so that we get a zoomed in section of the plot.
set(gca,'YTick',[],'XTick',[], 'XLim',[909.850230414748 1359.85023041475],'YLim',[163.478891218168 187.138947135872]);
% Annotate the figure by adding arrows along the x and y axis to represent
% increasing time and concentration.
annotation(figure6,'arrow',[0.133928571428571 0.914285714285714],...
    [0.0466190476190482 0.0476190476190482],'LineWidth',4);
annotation(figure6,'arrow',[0.0982142857142857 0.0982142857142857],...
    [0.103761904761905 0.919047619047619],'LineWidth',4);
% Add a 3rd arrow to the plot to show increasing initial concentration of
% Cv in the legend.
annotation(figure6,'arrow',[0.817857142857141 0.817857142857143],...
    [0.597619047619051 0.238095238095238],'LineWidth',4);
% Set legend as just lines with no text, as text will be added later using
% paint (see wiki figures).
legend4=legend('','','','','','','','','','');
% Set the position of the legend and the width of the box line.
set(legend4,...
    'Position',[0.631547602609266 0.207142857142858 0.255952397390734 0.413492042689934],...
    'LineWidth',2);
% Set the x and y labels to Increasing Time and Increasing Concentration
% respectively.
xlabel ('Increasing Time', 'FontSize', 15);
ylabel ('Increasing Concentration','FontSize', 15);
%
%
% END OF FILE
Back to Top View Description of Model

Bone Incision Data

Lorem ipsum dolor sit amet, nostrud maiestatis quaerendum ne sed. Reque possit ne sea. Te dico labitur mediocritatem ius. Error timeam noluisse eos ad, eam ne magna meliore contentiones, nec ei volumus persecuti. Dicit animal definitionem et mel, nonumy tacimates nec in. Vis mucius periculis at. At est vidit scripserit repudiandae, agam porro sea ne. Sea et stet tibique praesent, vim et legere aperiri. Quo doming vocibus eleifend no. Cu vis partem graeci facilisis. Falli inciderint mei no. Assentior suscipiantur mea id. Vis quas electram prodesset cu, choro omnium conclusionemque an his. Vis latine equidem perfecto ad.

Bone Incision Experiment Code

code.


  MATLAB code from bone.m file


k=6.23*10^(-9);%wear coefficient
W=zeros(1,101);%zero vector for calculated volume of bone incision m^3
s=(0:0.001:0.1);%range of values for blade length m, from 0 to 10cm
p=(0:2:200);%range of values for applied force N, from 0 to 200N

for i=1:101
    for j=1:101
    W(i,j)=k*p(i)*s(j); %Archards Equation in two for loops
    %to create a matrix of possible values for volume
end
end

surf(p,s,W)%creates a surface plot, where the height and therefore colour are dependand on the matric W
grid on
title('Relationship Between Volume of Bone Incison, Force and Blade length')
zlabel('Volume of Incision/m^3')
ylabel('Blade Length/m')
xlabel('Applied Load/N')
Back to Top View Description of Experiment

To see the MATLAB code for the BioSpray section of the project or the Fingerprint Aging section of the project use the following buttons.

Appendix 2: Fingerprint Aging Appendix 1: BioSpray