Note that while each sub function can run on its own, I recommend using the top level function compressible.m to avoid formatting confusion.
This function solves for the relations associated with isentropic compressible flow, normal shock relations, isentropic flow with heat addition and friction, solutions for the Prandtl-Meyer function and Mach angle, and the Theta-Beta-Mach relation for oblique shocks. It does so for any value inputted and for any value of gamma, where gamma is the ratio of the specific heats. Also note that this function CAN handle vectors of inputs, and will return them in the same shape as the input if it can. This function can be used in three ways:
- If no input or output is specified, it will run a GUI that prompts the user to decide which table and input type, as well as the gamma that will be used. The GUI then displays the results in a table integrated into the figure.
- If inputs are included but not outputs, the function will print the results in the workspace.
The above to methods are useful if these function is used to find values for reference or homework assignments. If the calculations are to be used within a function, the third option is:
- If inputs and outputs are included, the function will place the results into the output variables without printing or displaying anything. This use of the function allows for it to be integrated into a new function
All formula derivations are from:
Anderson, John D. Modern Compressible Flow: With Historical Perspective. New York: McGraw-Hill, 1982. Print.
All code and formatting by Thomas Ransegnola. If there are errors, or you would like for something else to be added, please let me know at firstname.lastname@example.org
Tom R (2021). Compressible Flow Relations (https://www.mathworks.com/matlabcentral/fileexchange/48300-compressible-flow-relations), MATLAB Central File Exchange. Retrieved .
You should indicate that you require the Symbolic Math Toolbox. Alternatively, you could replace all symbolic solutions with numerical ones. Example: replace lines 54 to 56 in isentropicrel by:
fun = @(x) ((1+((gamma-1)./2).*(x).^2).^(1/(gamma-1))).^gamma - p0p(i);
M(i,1) = fzero(fun,1);
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!