Using the output of one m-file in Matlab as the input to another? Establishing the connection
Afficher commentaires plus anciens
I have created the functions but dont know how to proceed? like how to establish the connection?
Let's say that:
1) the first function produces a concentration profile with respect to time for a given period of let's say 1 hour of exposure: C(t)
2) The second function computes dosage as D(c,t)= C^a * delta t, where C is found in 1 and a is a constant
Dosage is computed for 4 different time intervals so that the final outcome is D1 (for the first time interval, say the first 10 minutes), D2(for the second time interval, and is accumulative such that D2 = D1+ C2*deltat2),...etc
Also, how can I write the code for the dosage such that it's computed not only once but 4 times, each time for a given time interval
Hope my question is clear, and sorry for the so many questions. I haven't used Matlab since 2008-2009.
Thanks in advance.
Réponse acceptée
Plus de réponses (1)
dpb
le 4 Jan 2015
Given the function (let's call it f1) and the vector t over which to compute...
C=f1(t); % the concentration
D=trapz(t,C); % the dose integral
Catégories
En savoir plus sur Numerical Integration and Differentiation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!