Tsec = second(IP1.Time);
Volts = IP1.Volt;
Voltsd = Volts - Volts(1);
VoltsL = Voltsd > 0.01;
Ix0 = find(Voltsd>0.01, 1, 'first');
fcn = @(b,x) b(1).*(1 - exp(b(2).*(x + b(3))));
B = fminsearch(@(b) norm(Voltsd(VoltsL) - fcn(b,Tsec(VoltsL))), [1; -0.5; Tsec(Ix0);]);
T50 = fzero(@(t) fcn(B,t) - 0.5*B(1), 1)
T90 = fzero(@(t) fcn(B,t) - 0.9*B(1), 1)
figure
plot(Tsec(VoltsL), Voltsd(VoltsL), '-')
hold on
plot(Tsec(VoltsL), fcn(B,Tsec(VoltsL)), '-r')
xl = min(xlim);
yl = min(ylim);
plot([xl T50], [1 1]*0.5*B(1),'--g', [1 1]*T50, [yl 0.5*B(1)],'--g')
plot([xl T90], [1 1]*0.9*B(1),'--c', [1 1]*T90, [yl 0.9*B(1)],'--c')
hold off
grid
xlabel('Time (s)')
ylabel('Volts')
text(T50, 0.5*B(1), sprintf('\\leftarrow 50%%: %4.1fV, %4.1fs', 0.5*B(1), T50), 'HorizontalAlignment','left', 'VerticalAlignment','middle')
text(T90, 0.9*B(1), sprintf('\\leftarrow 90%%: %4.1fV, %4.1fs', 0.9*B(1), T90), 'HorizontalAlignment','left', 'VerticalAlignment','middle')