expdecaydata; % generate data tau0 = 2.0; eps = 1.0; thresh = 0.00001; [tauest, taus, mses] = expdecaydescent(time, voltage, tau0, eps, thresh); subplot(2, 2, 1); % top left panel hold on; plot(taus, '-o'); plot([1, length(taus)], [tau, tau], 'k'); % line indicating true tau hold off; xlabel('Iteration'); ylabel('tau [ms]'); subplot(2, 2, 3); % bottom left panel plot(mses, '-o'); xlabel('Iteration steps'); ylabel('MSE'); subplot(1, 2, 2); % right panel hold on; % generate x-values for plottig the fit: plot(time, voltage); % plot original data plot(time, expdecay(time, tauest), 'LineWidth', 2); % plot fit xlabel('Time [ms]'); ylabel('Voltage [mV]'); legend('data', 'fit', 'location', 'northeast'); savefigpdf(gcf, 'expdecayplot.pdf', 15, 10);