My working code is below. It spits out a sequence of values for mmhgnew that represent the new concentration each day. What I want to do from here is calculate these mmhgnew values using many input values for flowrate, paro, mmhgo, and transit. I would like to have these input values read off of a table. I'm just not sure the best way to proceed. Any help appreciated. Thanks!
flowrate=5.79e10; %Flow rate in L day-1, this is a monthly averaged value
paro=49.29369; %surface mean monthly PAR value mol m-2 day-1
mmhgo=0.09; %initial MMHg concentration
transit=10 mmhgmo=mmhgo*flowrate; %initial MMHg mass in 1 day's worth of water, entire depth profile
for d=1:transit %d is the number of days of transit from source to export site
for z = 1:70 %z is the number of depth layers, 0.1 m each down to 7 m
parz(z)=paro*exp(-0.189*z) % the kz value in (0.1 m-1)
end mmhgz=mmhgo*exp(-0.011*parz) %calcalates the concentration of MMHg in each 0.1 m layer using an average kd value
mmhgmz=flowrate*mmhgz/70 %calculates the mass of MMHg in each layer in ng day-1 (assumes water mass is evenly distributed with depth
mmhgmsum=sum(mmhgmz) %returns the mass of MMHg for the entire water column in ng
mmhgmloss=mmhgmo-mmhgmsum %returns the mass of MMHg lost by comparing to the initial MMHg mass
mmhgmo=mmhgmo-mmhgmloss %returns the new mass of MMHg in the water column after each day
mmhgo=mmhgmo/flowrate %returns the new concentration of MMHg in the water column after each day
mmhgnew(d)=mmhgo %outputs the new MMHg concentration for each day of transit
end
Best Answer