solving a function iteratively , looping it with increasing values then summing those values
3 次查看(过去 30 天)
显示 更早的评论
I constructed a 'code' that essentially is a calculation of isotope production and decay via cosmic ray bombardment, in sediment over a given time, at a given depth beneath the surface of the earth. But this models instantaneous burial of the sediment and subsequent production/decay at the present depth, and I want to use the existing code to model production of isotopes during the process of slow burial, in say 1 meter/ 10,000 year increments, up to a specific depth (the burial depth of a sample), then sum those outputs. I know I need to loop this code but I haven't been able to wrap my head around the nuts and bolts of it (complete novice). I thought of solving this iteratively, anyone have recommendations? attached is the code, with lots of annotations and comments.
I think I want to loop lines 62-68 increasing z from 1 meter - say 100 m (a known burial depth) then sum the outputs (?), which in turn become input for further calculations. THANK YOU!
2 个评论
Geoff Hayes
2014-10-15
Cody - in your code, you define z and t as
z = 16400; % sample depth in cm
t = 1377000; % time in years since
Want do you want your starting depth and starting year to be - 100 (for one metre) and 10000 (years) respectively? What should the end depth and end time be?
Do you then fix the depth and then just change the year
for z=100:100:100000 % start at 100 cm and increment by 100
for t=10000:10000:?? % start at 10000 years and increment by 10000
or fix the year and change the depth
for t=10000:10000:?? % start at 10000 years and increment by 10000
for z=100:100:100000 % start at 100 cm and increment by 100
How would you use the output, Epaleo, from one iteration, as the input for the next iteration?
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Oceanography and Hydrology 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!