This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/regression/exercises/exp2fit.m

16 lines
335 B
Matlab

expdecaydata;
close all;
p0 = [0.5, 6.0];
pest = lsqcurvefit(@(p, x) exp2func(x, p), p0, time, voltage);
fprintf('c=%4.1fmV, tau=%4.1fms\n', pest(1), pest(2));
hold on;
plot(time, voltage)
plot(time, exp2func(time, pest), 'LineWidth', 2)
hold off;
xlabel('time [ms]')
ylabel('voltage [mv]')
savefigpdf(gcf, 'exp2fit.pdf', 15, 8.5);