Difference between revisions of "MATLAB: Estimating viscoelastic spectrum using Mason's method"
From Course Wiki
(→Function implementation) |
|||
Line 7: | Line 7: | ||
==Function implementation== | ==Function implementation== | ||
− | <tt>CalculateViscoelasticSpectrumMason</tt> computes G*, G', and G'' from a vector of MSD values. The function smoothes the MSD data with a sliding boxcar average. An optional parameter specifies the width of the averaging window. | + | <tt>CalculateViscoelasticSpectrumMason</tt> computes G*, G', and <nowiki>G''</nowiki> from a vector of MSD values. The function smoothes the MSD data with a sliding boxcar average. An optional parameter specifies the width of the averaging window. |
<pre> | <pre> |
Revision as of 02:27, 5 October 2013
This page demonstrates how to compute the viscoelastic modulus of a complex fluid from a vector of MSD values using the method of Mason, et al.[1] .
Function implementation
CalculateViscoelasticSpectrumMason computes G*, G', and G'' from a vector of MSD values. The function smoothes the MSD data with a sliding boxcar average. An optional parameter specifies the width of the averaging window.
function [Gstar, GPrime, GDoublePrime, Tau ] = CalculateViscoelasticSpectrumMason(MsdValues, SamplingFrequency, ParticleRadius, Temperature, Smoothing) Tau = (1:length(MsdValues))' / SamplingFrequency; kB = 1.38e-23; % Boltzmann constant if(nargin < 5) Smoothing = 3; end if(nargin < 4) Temperature = 293; end smoothLogMsdValues = log(smooth(MsdValues, Smoothing)); smoothTimeInterval = Tau; % create a time interval axis to match diff(MSD) Tau = (smoothTimeInterval(1:(end-1)) + smoothTimeInterval(2:end)) / 2; shiftedMsd = (smoothLogMsdValues(1:(end-1)) + smoothLogMsdValues(2:end)) / 2; % compute G*, G' and G'' by Mason method alpha = diff(smoothLogMsdValues) ./ diff(log(smoothTimeInterval)); gammaOfAlpha = 0.457 * (1 + alpha).^2 - 1.36 * (1 + alpha) +1.9; % approimation value from Mason %gammaOfAlpha = gamma(1 + alpha); Gstar = abs(2 * kB * Temperature ./ (3 * pi * ParticleRadius * shiftedMsd .* gammaOfAlpha)); GPrime = Gstar .* cos(pi * alpha / 2); GDoublePrime = Gstar .* sin(pi * alpha / 2); end
Testing the function
The following code generates synthetic MSD vectors for testing CalculateViscoelasticSpectrumMason.
% this code tests the CalculateGStarGPrimeGDoublePrime function by % simulating MSDs for two extreme cases: a particle on a spring and a % freely diffusing particle close all numberOfFrames = 1800; numberOfMsds = 1799; sampleRate = 10; particleRadius = 0.5e-6; tau = (1:numberOfMsds) / sampleRate; % generate synthetic MSD versus tau curve for a freely diffusing particle diffusionCoefficient = 1e-15; msdFree = diffusionCoefficient * tau; % compute MSD versus time interval vector and G*, G', G'' [gStarFree, gPrimeFree, gDoublePrimeFree, outputTau] = CalculateGStarGPrimeGDoublePrime(msdFree, sampleRate, particleRadius); % now simulate a confined microsphere (see Mason equation 4) saturationMsd = sqrt(.01e-15); diffusionTimeConstant = 1 / 3; msdConfined = saturationMsd ^ 2 * (1 - exp(-tau / diffusionTimeConstant)); % compute MSD versus time interval vector and G*, G', G'' [gStarConfined, gPrimeConfined, gDoublePrimeConfined, outputTau] = CalculateGStarGPrimeGDoublePrime(msdConfined, sampleRate, particleRadius); figure; loglog( outputTau, gPrimeFree, outputTau, gDoublePrimeFree, outputTau, gPrimeConfined, outputTau, gDoublePrimeConfined ); legend( 'G'' Free', 'G'''' Free', 'G'' Confined', 'G'''' Confined');
Cite error: <ref>
tags exist, but no <references/>
tag was found