MATLAB: Fitting exponential

exponentialfitfittinginterpolation

Hi, I want to fit my data with an exponential curve. I use fit and fittype=exp. So far no problem. But now I only want to use the first 600 data points and the last 200 datapoints (every trace has 15000 datapoints) and make an exponential fit over the whole trace only using this datapoints.
Can anybody help me which methods to use?
Thanks for your efforts!

Best Answer

I will assume that you have the 15,000 data samples stored in the MATLAB Workspace as a 15,000 x 1 column vector called dataset.x.
%%Create time domain:
N = size(dataset.x,1);
Fs = 125;
dt = 1/Fs;
dataset.t = dt*(0:N-1)';
%%Create subset:
p = 600;
q = 200;
subset.x = [ dataset.x(1:p) ; dataset.x(end-q+1:end) ];
subset.t = [ dataset.t(1:p) ; dataset.t(end-q+1:end) ];
%%Exponential fit:
fitType = 'exp1';
myFit = fit(subset.t,subset.x,fitType);
HTH.
Rick