Quartz cement accumulation graph not plotting correctly

3 views (last 30 days)
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!

Accepted Answer

Star Strider
Star Strider on 5 Apr 2015
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.)')

More Answers (0)

Categories

Find more on Agriculture in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!