How do I estimate average of a variable over the discretized domain
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
5 Comments
Accepted Answer
- Calculate W and Tair averages: Rather of utilizing W(i) and Tair(i) for each division, compute the average value of W and Tair throughout the discretised domain at each time step.
- Use the following averages in the equations: Replace W(i) and Tair(i) with the derived averages when computing P_vap and P_sat to represent the overall domain conditions at each time step.
- Calculate the total mass of water adsorbed. Integrate (average) the Q values over the domain at each time step to calculate the total mass of water adsorbed in the bed.
- Calculate the dehumidification capacity: Calculate the difference between the average W at the inlet and outlet (first and last discretization points), which represents the dehumidification capacity.
19 Comments

@Torsten: I want to compute Q as dependent on the spatial coordinate. But Q_eq should not depend on spatial coordinate rather it should be computed using mean values of W and T_air. So we need the loop "for i=1:n" for Q(i). Does this answer your question?
Btw, what should be the expression for W_avg? Should it be something like below?
For i=1:n W_avg =mean (W(i),1); End
This should return the row vector for W_avg at each time step over the n discertized domain, correct?


@Torsten I have one more question. I want to run my code first 300 sec for adsorption and next 300 sec for desorption. How to set different values for adsorption and desorption for the following variables in my code?
K_LDF, h_sa, W_in; % inlet humidity in kg/kg_dry air Tair_in; % inlet air temperature in K U_in % inlet air velocity in m/sec.
I also need to change the signs of source terms in the governing equations of mass and energy during adsorption and desorption cycles.
I shall highly appreciate it you can help me to write the code for this part. Thanks 🙏

@Torsten, I am facing another simple problem in this code. Tried for hours today but couldn't solve. I want to save the values of "phi" at each time step in an excel file. It should be easy but I wasn't successful. Could you please provide the code to save phi in excel file? I shall remain grateful to you.
More Answers (0)
Categories
Find more on Thermal Analysis in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)