Difference between revisions of "Assignment 9, Part 1: model function"

From Course Wiki
Jump to: navigation, search
Line 25: Line 25:
 
</pre>
 
</pre>
  
In a similar fashion, write the following functions in MATLAB which model the phenomena of photobleaching and thermal quenching:
+
In a similar fashion, write functions in MATLAB for ''S(t)'', the expression for photobleaching, and ''Q(t)'', the expression for thermal quenching. You are welcome to use the following templates as a guide.
  
 
<pre>
 
<pre>
Line 41: Line 41:
 
</pre>
 
</pre>
  
Finally, put everything together into a single model function that represents
+
Finally, put everything together into a single model function that represents:
<math>\left . V_{f,model}(t) = K_{gain} S(t) Q(t) C_{ds}(T_{sample}(t), \Delta H^\circ, \Delta S^\circ) + K_{offset}\right .</math>
+
:<math>\left . V_{f,model}(t) = K_{gain} S(t) Q(t) C_{ds}(T_{sample}(t), \Delta H^\circ, \Delta S^\circ) + K_{offset}\right .</math>
 
+
''S(t)'' is the expression for photobleaching, ''Q(t)'' is the expression for thermal quenching, and ''C<sub>ds</sub>'' is the model melting curve produced by the <code>DnaFraction</code> function from part 1 of the lab.
+
  
 +
Here, ''C<sub>ds</sub>'' is the model melting curve produced by the <code>DnaFraction</code> function from part 1 of the lab.
  
 
In order for the function to be compatible with MATLAB's <tt>nlinfit</tt>, the first input argument must be a vector containing all the parameters to be fitted, and the second argument must contain a vector/matrix of the independent variable(s). Don't forget to include parameters for the instrument gain and offset, and <math>\Delta H^\circ, \Delta S^\circ</math>, as well as the bleaching, quenching, and thermal time constants.
 
In order for the function to be compatible with MATLAB's <tt>nlinfit</tt>, the first input argument must be a vector containing all the parameters to be fitted, and the second argument must contain a vector/matrix of the independent variable(s). Don't forget to include parameters for the instrument gain and offset, and <math>\Delta H^\circ, \Delta S^\circ</math>, as well as the bleaching, quenching, and thermal time constants.

Revision as of 14:57, 23 August 2017

20.309: Biological Instrumentation and Measurement

ImageBar 774.jpg


This is Part 1 of Assignment 9.

The wiki page on the DNA model function outlines a way to model the sample temperature based on the block temperature:

function SimulatedTemperatureOutput = SimulateLowPass( TimeConstant, InputData, TimeVector )
    if( nargin < 3 )
        TimeVector = (0:(length(InputData)-1))/10;
    end

    transferFunction = tf( 1, [TimeConstant, 1] );

    initalTemperature = InputData(1);
    InputData = InputData - initalTemperature;

    SimulatedTemperatureOutput = lsim( transferFunction, InputData, TimeVector' ) + initalTemperature;
end

In a similar fashion, write functions in MATLAB for S(t), the expression for photobleaching, and Q(t), the expression for thermal quenching. You are welcome to use the following templates as a guide.

function SimulatedBleachingOutput = SimulatePhotobleaching( Kbleach, InputData )

    ...

end

function SimulatedQuenchingOutput = SimulateThermalQuenching( Kquench, InputData )
    
    ...

end

Finally, put everything together into a single model function that represents:

$ \left . V_{f,model}(t) = K_{gain} S(t) Q(t) C_{ds}(T_{sample}(t), \Delta H^\circ, \Delta S^\circ) + K_{offset}\right . $

Here, Cds is the model melting curve produced by the DnaFraction function from part 1 of the lab.

In order for the function to be compatible with MATLAB's nlinfit, the first input argument must be a vector containing all the parameters to be fitted, and the second argument must contain a vector/matrix of the independent variable(s). Don't forget to include parameters for the instrument gain and offset, and $ \Delta H^\circ, \Delta S^\circ $, as well as the bleaching, quenching, and thermal time constants.

function SimulatedOutput = Vfmodel( Parameters, InputData )
    tauThermal = Parameters(1);
    Kbleach = Parameters(2);

    ...

end


Pencil.png

your code (after having tested it in part 2)