% PS02_5func.m is the func file for problem set 2 question 5. % it is constant offset on a linearly increasing baseline with two peaks % the command line that calls this is: % [f,p,kvg,iter,corp,covp,covr,stdresid,Z,r2]=nlleasqr(t,y,pin,'PS02_5func'); function out=PS02_5func(t,a) out=a(1)+a(2)*t+a(3)*exp(-((t-a(4))/a(5)).^2)+a(6)*exp(-((t-a(7))/a(8)).^2); % Coefficient definitions (initial guess) % a(1) = baseline (5) % a(2) = baseline slope (.1) % a(3) = height peak 1 (10) % a(4) = peak center 1 (8) aka elution time 1 % a(5) = width of peak 1 (1) % a(6) = height peak 2 (15) % a(7) = peak center 2 (12) aka elution time 2 % a(8) = width of peak 2 (1)