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

From Course Wiki
Jump to: navigation, search
(Created page with "Category:Lab Manuals Category:20.309 Category:Optical Microscopy Lab {{Template:20.309}} This is Part 1 of Assignment 9. <br> The wik...")
 
Line 21: Line 21:
 
     InputData = InputData - initalTemperature;
 
     InputData = InputData - initalTemperature;
  
     SimulatedOutput = lsim( transferFunction, InputData, TimeVector' ) + initalTemperature;
+
     SimulatedTemperatureOutput = lsim( transferFunction, InputData, TimeVector' ) + initalTemperature;
 
end
 
end
 
</pre>
 
</pre>
Line 28: Line 28:
  
 
<pre>
 
<pre>
function SimulatedBleachingOutput = SimulatePhotobleaching( Kbleach, InputData, TimeVector )
+
function SimulatedBleachingOutput = SimulatePhotobleaching( Kbleach, InputData )
    if( nargin < 3 )
+
        TimeVector = (0:(length(InputData)-1))/10;
+
    end
+
  
 
     ...
 
     ...
Line 37: Line 34:
 
end
 
end
  
function SimulatedQuenchingOutput = SimulateThermalQuenching( Kquench, InputData, TimeVector )
+
function SimulatedQuenchingOutput = SimulateThermalQuenching( Kquench, InputData )
     if( nargin < 3 )
+
      
        TimeVector = (0:(length(InputData)-1))/10;
+
    end
+
 
+
 
     ...
 
     ...
  

Revision as of 18:09, 18 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 the following functions in MATLAB which model the phenomena of photobleaching and thermal quenching:

function SimulatedBleachingOutput = SimulatePhotobleaching( Kbleach, InputData )

    ...

end

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

end

Finally, put everything together into a single model function that will be compatible with MATLAB's nlinfit (the first input argument is a vector containing parameters, the second contains 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 $.

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

    ...

end


Pencil.png

your code (after having tested it in part 2)