how to calculate for a range of values for different initial conditions
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
joshua payne
le 29 Nov 2022
Réponse apportée : Walter Roberson
le 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 commentaires
Réponse acceptée
Walter Roberson
le 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 commentaires
Plus de réponses (1)
David Hill
le 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 commentaires
Voir également
Catégories
En savoir plus sur Gas Dynamics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!