clear 

C1=4.7*10^-6; % in farads
C2=22*10^-6;
C3=220*10^-6;
C4=2200*10^-6;

C(1,:)=C1;
C(2,:)=C2;
C(3,:)=C3;
C(4,:)=C4;

Vs=1; %Voltage in (guess)
R=100000; % in ohms
RC=R*C; %Time constant
t=0:0.1:1400; %Time in seconds

for i=1:length(C);
Vc(i,:)=Vs.*(1-exp(-t./RC(i,:)));
end
FigHandle = figure('Position', [1000, 1000, 1080, 720]);
plot(t,Vc) %For varing charges 
TitleVoltage=num2str(Vs);
str=strcat('Time vs measure voltage where Vin=', num2str(Vs));
title(str,'FontSize',20)
xlabel('Time, seconds','FontSize', 20)
ylabel('Measured voltage, V','FontSize', 20)
legend('4.7 \muf','22 \muf','220 \muf','2200 \muf')
set(legend,'FontSize',24);
set(gca,'FontSize',20)
% print(FigHandle,'MySavedPlot','-dpng')
% close all