MATLAB

Discussion in 'General Chat' started by adhweorniatweege3532323, Nov 19, 2007.

  1. aLRIGHT.

    So I'm writing a program to do some basic DNA binding analysis in MATLAB and I'm importing the data from several files.

    Now here's the problem: the files aren't just matricies of data, but contain about eight lines of other information at the top of the file (which are text files). Of course, this means that the number of columns is not uniform throughout the ENTIRE file, so the load function doesn't work.

    I'd like to be able to upload the data without creating new files minus the header data (also, it'd be nice if it could autoimport some of the data in the header into another vector).

    The PI of the group I'm doing this for said he had a function which could do this, but I can't make heads or tails of it and his notes are pretty much as cryptic as his script. I think this is the appropriate code:


    dir = pwd; 'C:\matlab\DNA_dye_project\rhodamine'
    dir = dir
    dir = strcat(dir,'\Data-Aug09\')

    num_files = 26;

    % x_axis = linspace(200,800,301)'; %change this if changing limits on UV-VIS

    DS = [];
    for k = 1:num_files % columns
    str=num2str(k);
    name=['dna89' str '.wav'];
    fn =[ dir name];
    [ds ]= get_UV_data(fn);
    % x_axis = ds:),1);
    %data_uncorrected = [x_axis ds];
    %data_corrected = AutoBaseLine(data_uncorrected,2);
    %ds = data_corrected:),2);
    DS = [DS ds:),2)];
    end


    But I don't know what the #$%#.

    Any help would be greatly appreciated.
     
  2. Rhodamine? Are you doing fluorescence experiments?

    Wait. What is rhodamine and DNA doing in the same sentence? Isn't rhodamine highly poisonous?
     
  3. That doesn't look like anything that I ever typed into matlab.
     
  4.  
  5. More like that shit I took earlier.
     
  6. Intercalating dye research. You don't put rhodamine into a living system, but rather into a sample. Same thing you do with Ethidium, for example. Pretty much all intecalating dyes are tetragens by the nature of their binding to DNA.
     
  7.  
  8. Same.
     
  9. That's exactly why I don't know what the #$%#. He says it works, but I'm pretty sure it's about as arcane and disordered as is physically possible. He never wrote it with the intention of anyone else ever having to understand it.
     
  10. Here's the complete program:


    % fit absorbance data to an independent binding model.
    % D_not is the concentration of Dye
    % N_not is the number of sites (from DNA) in solution

    % Need to estimate Kd, the dissociation constant (in M), Dnot and Nnot.
    % Have a routine that will compute D/Dnot = fraction free dye

    % Bring in the Absorbances as a function of wavelength. use the

    clear all
    close all

    %path(path,'C:\matlab\mytools')
    %path(path,'C:\matlab\DNA_dye_project')
    % path(path,'C:\matlab\mytools')
    % path(path,'C:\matlab\DNA_dye_project')
    % path(path,'C:\matlab')

    dir = pwd; 'C:\matlab\DNA_dye_project\rhodamine'
    dir = dir
    dir = strcat(dir,'\Data-Aug09\')

    num_files = 26;

    % x_axis = linspace(200,800,301)'; %change this if changing limits on UV-VIS

    DS = [];
    for k = 1:num_files % columns
    str=num2str(k);
    name=['dna89' str '.wav'];
    fn =[ dir name];
    [ds ]= get_UV_data(fn);
    % x_axis = ds:),1);
    %data_uncorrected = [x_axis ds];
    %data_corrected = AutoBaseLine(data_uncorrected,2);
    %ds = data_corrected:),2);
    DS = [DS ds:),2)];
    end

    % DS is now 301 x num_files


    str='\rhb891';
    name=[str '.wav'];
    fn =[ dir name];
    [ DyeRef ]= get_UV_Data(fn);
    x_axis = DyeRef:),1);
    CorR = false(size(x_axis));
    Ifx = find( x_axis > 700 & x_axis [inequality goes here] 800 );
    CorR(Ifx) = true(size(Ifx));
    review = true
    figure(2)
    DyeRefOrig = DyeRef:),2);
    [dxy, PFit ] = AutoBaseLine([ x_axis(CorR), DyeRef(CorR,2) ],98);
    DyeRef = DyeRef:),2) - polyval(PFit,x_axis);
    plot(x_axis,DyeRef,'k--',x_axis,DyeRefOrig)
    if(review) pause, end
    % Concentration of Dye in the cuvette in the reference sample
    LnotRef = 1.5 * 20 / ( 2500+20); % concentration in mg/ml

    % data_corected = AutoBaseLine(data_uncorrected,2);
    % ds = data_corrected:),2);
    % x_axis = ds:),1);
    % Full_DS = [ds:),2) DS];
    % num_files = num_files+1;
    %
    % this full_DS is a matrix of all the columns of y-axis data

    % need to create the x axis for the above y values
    data_all = [x_axis DS]; % first column is x_axis

    figure(1)
    subplot(2,1,1)
    plot(x_axis,DS ) % ,ds:),1),ds:),RefDex+1),'-k')
    xlabel('WaveLength \lambda (nm)')
    ylabel('Absorbance')
    title('Full Absorbance as DNA is titrated')


    wavBeg = find(x_axis == 440) % unbound, just EB reference
    wavEnd = find(x_axis == 610) %full bound reference

    data_trimmed = data_all(wavBeg:wavEnd,<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A>;
    % Base line correct use a region to find st line and subtract
    DS_Corr = DS;
    % CorR is the core region for baseline correction.
    CorR = false(size(x_axis));
    Ifx = find( x_axis > 700 & x_axis [inequality goes here] 800 );
    CorR(Ifx) = true(size(Ifx));
    review = true
    figure(2)
    for g = 1:num_files
    [dxy, PFit ] = AutoBaseLine([ x_axis(CorR), DS_Corr(CorR,g) ],98);
    DS_Corr:),g) = DS_Corr:),g) - polyval(PFit,x_axis);
    plot(x_axis,DS_Corr:),g),'k--',x_axis,DS:),g))
    if(review) pause, end
    end
    figure(1)
    subplot(2,1,2)
    plot(x_axis,DS_Corr ) % ,ds:),1),ds:),RefDex+1),'-k')
    xlabel('WaveLength \lambda (nm)')
    ylabel('Absorbance')
    title(' Full Absorbance Baseline Corrected ')

    % have Full_DS and DS_Corr which both run the full x_axis.
    % Now restrict the data over the wave range we want:
    Ifx = find( x_axis > 500 & x_axis [inequality goes here] 570 );
    Crop = false(size(x_axis));
    Crop(Ifx) = true(size(Ifx));
    ds = [ x_axis(Crop) DS_Corr(Crop,<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A> ];


    % need to input volumes of Dye (Rhodamine) added to the DNA
    % deleted first one, the eb.wav file (and DNAx = 0)
    Rhod_adds = [ 0 2 2 2 2 2 2 2 2 2 4 4 4 4 4 6 6 6 6 6 8 8 8 10 10 10 ];
    Rhodx = cumsum(Rhod_adds);

    % DNAx = [ 0 9.1505 31.0291 31.3848 37.9355 61.5719 170.2144 229.3403 266.3287 358.2610]

    Vol_init_sample = 2530; % Volume in microliters, w/ DNA and no Dye (eg Rhodamine)
    DNA_init_conc = 0.1186; % 10 * 30/(2500+30) mg/ml in the cuvette.
    Dye_init_conc = 1.5; % milligrams/ml in the epindorf
    MW_DNA = 2*330; % Molecular weight of a DNA base pair. Optional: times 2 right now for nearest neigbhbor exclusion
    MW_Dye = 479.02 ; % Molecular weight of the Dye (for Rhodamine)
    %----- end needed data


    DyeRef = DyeRef(Crop);

    figure(2)
    % RefDex = find(DNAx == 0) % unbound, just EB reference
    % RefBnd = find(DNAx == DNAx(end)); %full bound reference
    subplot(2,1,1)
    plot(ds:),1),ds:),2:end),ds:),1),DyeRef,'-k')
    subplot(2,1,2)
    plot(ds:),1),DyeRef,'-k')

    xlabel('WaveLength \lambda (nm)')
    ylabel('Absorbance')
    title('Dye Absorbance as DNA is titrated')
    % The aborbance curve that is the reference is where DNAx = 0
    Abs = ds:),2:end);,
    Wave = ds:),1);

    % Convert Dye and DNA to actual Molar Concentration units Molar
    % New concentrations are in milliMoles/ml or M
    DNA_not = DNA_init_conc .* ( Vol_init_sample ./ ( Vol_init_sample+ Rhodx) ) /MW_DNA;
    Dye_not = Dye_init_conc .* ( Rhodx ./ (Vol_init_sample+ Rhodx) )/MW_Dye; %Is there any dilution of the dye?
    Nnot = DNA_not(<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A>;
    Lnot = Dye_not(<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A>;
    LnotRef = LnotRef/MW_Dye;
    % OA = (Vol_init_sample )./ (Vol_init_sample+Rhodx)
    % OAs = OA(1:end-1);, OBs = OB(1:end-1);
    OA = 0.8*Dye_not/LnotRef;
    Y = ( Abs:),2:end) - DyeRef*OA(2:end) ) ./ (DyeRef*OA(2:end) );
    % assume that the RefBnd is the last one
    % Abss = Abs:),1:end-1);
    % Z = ( Abss - Abs:),RefDex)*OAs ) ./ (Abs:),RefBnd)*OBs - Abss );
    % % Z = Z:),1:end-1);
    % Abs_free = Abs:),RefDex)*OA;
    % FbZ = Z ./ ( 1 + Z );

    %%----- NEW Stuff -----
    %Before we fit data we condense all of the data to a single line
    %First choose the data you wish to keep.

    figure(3)
    subplot(1,2,1)
    plot(Wave,Y);
    subplot(1,2,2)
    % plot(Wave,FbZ);

    %[a,b] = ginput(4)
    %WavPic = sort(a);
    % WavPic = [ 500 540 541 570 ] % Ranges for two parts of data (nm)
    % Idpic = Closest(Wave,WavPic);
    % Index = [Idpic(1):Idpic(2) Idpic(3):Idpic(4)]';
    % YP = Y(Index,<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A>;
    % choose the Wave and Y parts from these chosen ranges
    m = Y'*Y;
    [u,s,v]=svd(m);
    F=-u:),1); %F is the best possible vector F'F=1
    a = Y*F;
    Ysim = a*F';% Simulated Data from a single F vector
    % Abs_sim = Ysim.*Abs_free + Abs_free;

    figure(3)
    %hold on

    %plot(ds:),1), Abs_sim);
    hold off
    figure(2)
    sigsq = trace(Y*Y')-a'*a; % This is the best one could possibly
    % do regardless of the model to determing the F vector.
    subplot(2,1,1)
    plot(Wave,Y)
    subplot(2,1,2)
    plot(Wave,Ysim);
    % F is the best set of experimental values and all points on the curve are
    % explained by this set of values. So now we need to simulate F by the
    % fraction bound: F= a *fb fb == fraction of dye bound to DNA.
    % Need to specify Dnot and Nnot for each data set.
    % Abs_not is the set of absorbances associated with Nnot = 0
    %
    % Y = (Abs - Abs_not ) ./ Abs_not;
    %
    % ff = fract_free(Dnot,Nnot,Kd);

    % The best set of bound fractions F from the Y data (of model 1)
    % but F'F=1 not scaled to the true bound fractions
    % the bound fraction from the Z data (of model 2) We now determine the
    % best scale on F is found from
    Fbmean = mean(FbZ,1)'; % this is missing the value for the last component which is one
    Fp = F(1:end-1)
    scale = Fp'*Fbmean / (Fp'*Fp);
    FFb = scale*F;
    Fbmean = [ Fbmean ; 1];
    % a guess at the binding constant and an appx fit
    Kb = 5e4;
    [ fbguess , fbapx ]= BoundDye(Nnot,Lnot,Kb);
    figure(4)
    plot(DNAx,FFb,'g*',DNAx,Fbmean,'rd',DNAx,fbguess,'kx')
    xlabel('DNA Concentration');, ylabel('Fraction Dye Bound to DNA')
    legend('model 1','model 2','n=1 Kb=1e5',0)
    figure(5)
    EpsRatio = ( a/scale)+1;
    plot(Wave,EpsRatio)
    xlabel('Wavelength');, ylabel('Ratio \epsilon_{bound} / \epsilon_{free}')
    % [ FFb Fbmean fbguess FFb-Fbmean]
    % for the values of Dnot and Nnot and Kd plot
    % fb = 1-ff;
    % plot(fb, Y) % this should be proportinal Y = mX
    %
    %We can use a Marq-Lev search for the model for the fit:
    % F = a * fb and fb = (Nnot/Lnot) * r
    % r a function of Nnot and Lnot (which are known)
    % r parametrically depends on K and n and so we optimize K n and a
    % the scale factor a is of no consequence excpet to scale the other a's
    % above.
    % least squares fit to the data ds = [ Nnot F ] P_in [ Scale K n] Px1 =
    % Lnot funct = Calcfb
    % [ P_opt , P_opt_err ]= grad_weight(funct,P_in,float,ds,Px1,Px2,Px3)

    % sf = 3;,
    % Fsf = F*sf;
    % P_in = [ 1 3e8 1]';, float = [ 0 1 0]'; , dsF = [ Nnot Fsf ones(size(F))];
    % Par = P_in;
    % [ P_opt , P_opt_err ]= grad_weight('Calcfb',P_in,float,dsF,Lnot);
    % P_opt = P_in
    % Nthr = linspace(min(Nnot),3e-4,100);
    %
    % afb2 = Calcfb(Nnot,[P_opt(1:2); 10],Lnot);
    %
    % plot(Nnot,Fsf,'k*',Nnot,afb,'go',Nnot,afb2,'gd')
    % xlabel('[DNA] M ')
    % ylabel('Fraction Dye Bound')
    % set(gca,'ylim',[0 1])
    % legend('data','n=1 model','n=2 model',0)
    Here's the complete program:


    % fit absorbance data to an independent binding model.
    % D_not is the concentration of Dye
    % N_not is the number of sites (from DNA) in solution

    % Need to estimate Kd, the dissociation constant (in M), Dnot and Nnot.
    % Have a routine that will compute D/Dnot = fraction free dye

    % Bring in the Absorbances as a function of wavelength. use the

    clear all
    close all

    %path(path,'C:\matlab\mytools')
    %path(path,'C:\matlab\DNA_dye_project')
    % path(path,'C:\matlab\mytools')
    % path(path,'C:\matlab\DNA_dye_project')
    % path(path,'C:\matlab')

    dir = pwd; 'C:\matlab\DNA_dye_project\rhodamine'
    dir = dir
    dir = strcat(dir,'\Data-Aug09\')

    num_files = 26;

    % x_axis = linspace(200,800,301)'; %change this if changing limits on UV-VIS

    DS = [];
    for k = 1:num_files % columns
    str=num2str(k);
    name=['dna89' str '.wav'];
    fn =[ dir name];
    [ds ]= get_UV_data(fn);
    % x_axis = ds:),1);
    %data_uncorrected = [x_axis ds];
    %data_corrected = AutoBaseLine(data_uncorrected,2);
    %ds = data_corrected:),2);
    DS = [DS ds:),2)];
    end

    % DS is now 301 x num_files


    str='\rhb891';
    name=[str '.wav'];
    fn =[ dir name];
    [ DyeRef ]= get_UV_Data(fn);
    x_axis = DyeRef:),1);
    CorR = false(size(x_axis));
    Ifx = find( x_axis > 700 & x_axis [inequality goes here] 800 );
    CorR(Ifx) = true(size(Ifx));
    review = true
    figure(2)
    DyeRefOrig = DyeRef:),2);
    [dxy, PFit ] = AutoBaseLine([ x_axis(CorR), DyeRef(CorR,2) ],98);
    DyeRef = DyeRef:),2) - polyval(PFit,x_axis);
    plot(x_axis,DyeRef,'k--',x_axis,DyeRefOrig)
    if(review) pause, end
    % Concentration of Dye in the cuvette in the reference sample
    LnotRef = 1.5 * 20 / ( 2500+20); % concentration in mg/ml

    % data_corected = AutoBaseLine(data_uncorrected,2);
    % ds = data_corrected:),2);
    % x_axis = ds:),1);
    % Full_DS = [ds:),2) DS];
    % num_files = num_files+1;
    %
    % this full_DS is a matrix of all the columns of y-axis data

    % need to create the x axis for the above y values
    data_all = [x_axis DS]; % first column is x_axis

    figure(1)
    subplot(2,1,1)
    plot(x_axis,DS ) % ,ds:),1),ds:),RefDex+1),'-k')
    xlabel('WaveLength \lambda (nm)')
    ylabel('Absorbance')
    title('Full Absorbance as DNA is titrated')


    wavBeg = find(x_axis == 440) % unbound, just EB reference
    wavEnd = find(x_axis == 610) %full bound reference

    data_trimmed = data_all(wavBeg:wavEnd,<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A>;
    % Base line correct use a region to find st line and subtract
    DS_Corr = DS;
    % CorR is the core region for baseline correction.
    CorR = false(size(x_axis));
    Ifx = find( x_axis > 700 & x_axis [inequality goes here] 800 );
    CorR(Ifx) = true(size(Ifx));
    review = true
    figure(2)
    for g = 1:num_files
    [dxy, PFit ] = AutoBaseLine([ x_axis(CorR), DS_Corr(CorR,g) ],98);
    DS_Corr:),g) = DS_Corr:),g) - polyval(PFit,x_axis);
    plot(x_axis,DS_Corr:),g),'k--',x_axis,DS:),g))
    if(review) pause, end
    end
    figure(1)
    subplot(2,1,2)
    plot(x_axis,DS_Corr ) % ,ds:),1),ds:),RefDex+1),'-k')
    xlabel('WaveLength \lambda (nm)')
    ylabel('Absorbance')
    title(' Full Absorbance Baseline Corrected ')

    % have Full_DS and DS_Corr which both run the full x_axis.
    % Now restrict the data over the wave range we want:
    Ifx = find( x_axis > 500 & x_axis [inequality goes here] 570 );
    Crop = false(size(x_axis));
    Crop(Ifx) = true(size(Ifx));
    ds = [ x_axis(Crop) DS_Corr(Crop,<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A> ];


    % need to input volumes of Dye (Rhodamine) added to the DNA
    % deleted first one, the eb.wav file (and DNAx = 0)
    Rhod_adds = [ 0 2 2 2 2 2 2 2 2 2 4 4 4 4 4 6 6 6 6 6 8 8 8 10 10 10 ];
    Rhodx = cumsum(Rhod_adds);

    % DNAx = [ 0 9.1505 31.0291 31.3848 37.9355 61.5719 170.2144 229.3403 266.3287 358.2610]

    Vol_init_sample = 2530; % Volume in microliters, w/ DNA and no Dye (eg Rhodamine)
    DNA_init_conc = 0.1186; % 10 * 30/(2500+30) mg/ml in the cuvette.
    Dye_init_conc = 1.5; % milligrams/ml in the epindorf
    MW_DNA = 2*330; % Molecular weight of a DNA base pair. Optional: times 2 right now for nearest neigbhbor exclusion
    MW_Dye = 479.02 ; % Molecular weight of the Dye (for Rhodamine)
    %----- end needed data


    DyeRef = DyeRef(Crop);

    figure(2)
    % RefDex = find(DNAx == 0) % unbound, just EB reference
    % RefBnd = find(DNAx == DNAx(end)); %full bound reference
    subplot(2,1,1)
    plot(ds:),1),ds:),2:end),ds:),1),DyeRef,'-k')
    subplot(2,1,2)
    plot(ds:),1),DyeRef,'-k')

    xlabel('WaveLength \lambda (nm)')
    ylabel('Absorbance')
    title('Dye Absorbance as DNA is titrated')
    % The aborbance curve that is the reference is where DNAx = 0
    Abs = ds:),2:end);,
    Wave = ds:),1);

    % Convert Dye and DNA to actual Molar Concentration units Molar
    % New concentrations are in milliMoles/ml or M
    DNA_not = DNA_init_conc .* ( Vol_init_sample ./ ( Vol_init_sample+ Rhodx) ) /MW_DNA;
    Dye_not = Dye_init_conc .* ( Rhodx ./ (Vol_init_sample+ Rhodx) )/MW_Dye; %Is there any dilution of the dye?
    Nnot = DNA_not(<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A>;
    Lnot = Dye_not(<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A>;
    LnotRef = LnotRef/MW_Dye;
    % OA = (Vol_init_sample )./ (Vol_init_sample+Rhodx)
    % OAs = OA(1:end-1);, OBs = OB(1:end-1);
    OA = 0.8*Dye_not/LnotRef;
    Y = ( Abs:),2:end) - DyeRef*OA(2:end) ) ./ (DyeRef*OA(2:end) );
    % assume that the RefBnd is the last one
    % Abss = Abs:),1:end-1);
    % Z = ( Abss - Abs:),RefDex)*OAs ) ./ (Abs:),RefBnd)*OBs - Abss );
    % % Z = Z:),1:end-1);
    % Abs_free = Abs:),RefDex)*OA;
    % FbZ = Z ./ ( 1 + Z );

    %%----- NEW Stuff -----
    %Before we fit data we condense all of the data to a single line
    %First choose the data you wish to keep.

    figure(3)
    subplot(1,2,1)
    plot(Wave,Y);
    subplot(1,2,2)
    % plot(Wave,FbZ);

    %[a,b] = ginput(4)
    %WavPic = sort(a);
    % WavPic = [ 500 540 541 570 ] % Ranges for two parts of data (nm)
    % Idpic = Closest(Wave,WavPic);
    % Index = [Idpic(1):Idpic(2) Idpic(3):Idpic(4)]';
    % YP = Y(Index,<A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/smile.gif"></A>;
    % choose the Wave and Y parts from these chosen ranges
    m = Y'*Y;
    [u,s,v]=svd(m);
    F=-u:),1); %F is the best possible vector F'F=1
    a = Y*F;
    Ysim = a*F';% Simulated Data from a single F vector
    % Abs_sim = Ysim.*Abs_free + Abs_free;

    figure(3)
    %hold on

    %plot(ds:),1), Abs_sim);
    hold off
    figure(2)
    sigsq = trace(Y*Y')-a'*a; % This is the best one could possibly
    % do regardless of the model to determing the F vector.
    subplot(2,1,1)
    plot(Wave,Y)
    subplot(2,1,2)
    plot(Wave,Ysim);
    % F is the best set of experimental values and all points on the curve are
    % explained by this set of values. So now we need to simulate F by the
    % fraction bound: F= a *fb fb == fraction of dye bound to DNA.
    % Need to specify Dnot and Nnot for each data set.
    % Abs_not is the set of absorbances associated with Nnot = 0
    %
    % Y = (Abs - Abs_not ) ./ Abs_not;
    %
    % ff = fract_free(Dnot,Nnot,Kd);

    % The best set of bound fractions F from the Y data (of model 1)
    % but F'F=1 not scaled to the true bound fractions
    % the bound fraction from the Z data (of model 2) We now determine the
    % best scale on F is found from
    Fbmean = mean(FbZ,1)'; % this is missing the value for the last component which is one
    Fp = F(1:end-1)
    scale = Fp'*Fbmean / (Fp'*Fp);
    FFb = scale*F;
    Fbmean = [ Fbmean ; 1];
    % a guess at the binding constant and an appx fit
    Kb = 5e4;
    [ fbguess , fbapx ]= BoundDye(Nnot,Lnot,Kb);
    figure(4)
    plot(DNAx,FFb,'g*',DNAx,Fbmean,'rd',DNAx,fbguess,'kx')
    xlabel('DNA Concentration');, ylabel('Fraction Dye Bound to DNA')
    legend('model 1','model 2','n=1 Kb=1e5',0)
    figure(5)
    EpsRatio = ( a/scale)+1;
    plot(Wave,EpsRatio)
    xlabel('Wavelength');, ylabel('Ratio \epsilon_ / \epsilon_')
    % [ FFb Fbmean fbguess FFb-Fbmean]
    % for the values of Dnot and Nnot and Kd plot
    % fb = 1-ff;
    % plot(fb, Y) % this should be proportinal Y = mX
    %
    %We can use a Marq-Lev search for the model for the fit:
    % F = a * fb and fb = (Nnot/Lnot) * r
    % r a function of Nnot and Lnot (which are known)
    % r parametrically depends on K and n and so we optimize K n and a
    % the scale factor a is of no consequence excpet to scale the other a's
    % above.
    % least squares fit to the data ds = [ Nnot F ] P_in [ Scale K n] Px1 =
    % Lnot funct = Calcfb
    % [ P_opt , P_opt_err ]= grad_weight(funct,P_in,float,ds,Px1,Px2,Px3)

    % sf = 3;,
    % Fsf = F*sf;
    % P_in = [ 1 3e8 1]';, float = [ 0 1 0]'; , dsF = [ Nnot Fsf ones(size(F))];
    % Par = P_in;
    % [ P_opt , P_opt_err ]= grad_weight('Calcfb',P_in,float,dsF,Lnot);
    % P_opt = P_in
    % Nthr = linspace(min(Nnot),3e-4,100);
    %
    % afb2 = Calcfb(Nnot,[P_opt(1:2); 10],Lnot);
    %
    % plot(Nnot,Fsf,'k*',Nnot,afb,'go',Nnot,afb2,'gd')
    % xlabel('[DNA] M ')
    % ylabel('Fraction Dye Bound')
    % set(gca,'ylim',[0 1])
    % legend('data','n=1 model','n=2 model',0)
     
  11. I thought you quit this site, get the #$%# out. You only need one word to totally annoy me.
     
  12. WTF. He must have failed the class he took for MATLAB.
     
  13. Apparantly, the program works as it is written right now. Don't ask me, but I find it pretty impenetrable.
     
  14. Excuse me, wtf r u doin sleddriver?
     
  15. This #$%#s the mind of the common laborer!
     
  16. But ignoring all that shit,

    Is there a way to import only specific parts of a text file? How would I go about doing this?
     
  17. Good one, banana#$%#er.
     
  18. I like how there are smilie faces interjected into various parts of the code.
     
  19. Got bored as hell. Give me a break. <A BORDER="0" HREF="http://www.supercars.net/PitLane?displayFAQ=y"><IMG BORDER="0" SRC="pitlane/emoticons/tongue.gif"></A>
     
  20. NB might know.
    Send him a PM!
     
  21. Well I see your problem, you have smiley faces in your formula. MATLAB doesn't take smiley face inputs, try using Mathmatica instead.
     
  22. PI only uses MATLAB 6.5, so my program options are MATLAB 6.5, MATLAB 6.5, and MATLAB 6.5.

    I'll send NB a PM about this if this thread turns up nothing.
     
  23. Check your PMs
     

Share This Page