Quartz cement accumulation graph not plotting correctly

Hello, I am trying to model quartz cement accumulation in a fracture. I am currently trying to plot a graph of rate versus temperature but I am not getting a smooth curve as I vary T. Something very strange is plotting. Here is my script:
% q= %Volume of quartz (cm^3)
% T= 250; %constant temp (K)
dt= 1*365*24*3600; %time (s)
S= 50 %surfaces (cm^2), eq. assumes uniform growth rates on all surfaces
time= 0;
Ao= 9E-12; %Pre-exponential Arrhenius constant (mol/(cm^2s))
Ea= 50,000; %Activation energy for quartz precipitation (J/mol)
R= 8.314; %Real gas constant (J/molK)
M= 60.09; %Molar mass of quartz (g/mol)
rho= 2.65; %Density of quartz (g/cm^3)
for T = 0:10:250
q= S*(Ao)*exp((-Ea)/(R*T))*(M/rho)*dt;
rate=q/dt;
plot(0:10:250,rate,'r+')
xlabel('Temperature (C)')
ylabel('Rate (micrometer/m.y.)')
drawnow
hold on
end
% while time < 1*1e6*365*24*3600;
% q= S*(Ao)*exp((-Ea)/(R*T))*(M/rho)*dt;
% time=time+dt
% plot(q,'r+')
% drawnow
% hold on
% end
Any help is greatly appreciated. Thank you!

 Respuesta aceptada

Put the plot after the loop, and subscript ‘rate’ within the loop (with the rest of your code before the loop unchanged) and it works:
T = 0:10:250;
for k1 = 1:length(T)
q= S*(Ao)*exp((-Ea)/(R*T(k1)))*(M/rho)*dt;
rate(k1)=q/dt;
end
figure(1)
plot(T,rate,'r+')
xlabel('Temperature (C)')
ylabel('Rate (micrometer/m.y.)')

2 comentarios

THANK YOU!! WORKS GREAT NOW.

My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Networks en Centro de ayuda y File Exchange.

Preguntada:

el 5 de Abr. de 2015

Comentada:

el 5 de Abr. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by