how to calculate for a range of values for different initial conditions
5 views (last 30 days)
Show older comments
joshua payne
on 29 Nov 2022
Answered: Walter Roberson
on 29 Nov 2022
function [theta]=theta_beta_M(beta,M,gamma)
% return theta for beta-theta-M relationship for oblique shock
beta=linspace(0,(pi/2),90)
M=[1.25, 2, 6, 10)
gamma= 1.4
%cut off at Mach wave angle
if (beta<=asin(1./M)) theta=0; return; end
theta=atan(2.*cot(beta).*((M.*sin(beta)).^2-1)./(M.^2.*(gamma+cos(2.*beta))+2));
i want to be able to calculate theta values for each value of M for the range of beta.
0 Comments
Accepted Answer
Walter Roberson
on 29 Nov 2022
function [theta]=theta_beta_M(beta,M,gamma)
% return theta for beta-theta-M relationship for oblique shock
if nargin < 1; beta=linspace(0,(pi/2),90); end
if nargin < 2; M=[1.25, 2, 6, 10); end
if nargin < 3; gamma= 1.4; end
[beta,M] = ndgrid(beta, M);
theta = zeros(size(beta));
%cut off at Mach wave angle
mask = beta > asin(1./M);
theta(mask) = atan(2.*cot(beta(mask)).*((M(mask).*sin(beta(mask))).^2-1)./(M(mask).^2.*(gamma+cos(2.*beta(mask)))+2));
The result will be numel(beta) by numel(M) -- so one column for each different M value.
0 Comments
More Answers (1)
David Hill
on 29 Nov 2022
beta=linspace(0,(pi/2),90);
m=[1.25, 2, 6, 10];
[B,M]=meshgrid(beta,m);
gamma= 1.4;
theta=atan(2.*cot(B).*((M.*sin(B)).^2-1)./(M.^2.*(gamma+cos(2.*B))+2));
theta(B<=asin(1./M))=0
0 Comments
See Also
Categories
Find more on Gas Dynamics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!