MATLAB: Can’t i plot a graph for a against t

plottingsymbolicwhile loop

k_n= 7*10^-11;
n= 2;
i=1;
t(i)=0; %in hours
a = sym('a')
while t<=2.5 %2.5hours
a= 1-exp(-k_n*(t(i))^n); %degree of hydration
dt=1/3600; %1sec interval
t(i+1)=t(i)+dt;
i=i+1;
end
figure(1);
plot(t,a,'r'),xlabel('t [h]'),ylabel('degree of hydration');
hold on;

Best Answer

k_n= 7*10^-11;
n= 2;
dt=1/3600; %1sec interval
t=0:dt:2.5;
a= 1-exp(-k_n*(t).^n); %degree of hydration
t=0:dt:2.5;
figure(1);
plot(t,a,'r'),
xlabel('t [h]')
ylabel('degree of hydration')