how to calculate for a range of values for different initial conditions
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
joshua payne
am 29 Nov. 2022
Beantwortet: Walter Roberson
am 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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 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 Kommentare
Weitere Antworten (1)
David Hill
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Gas Dynamics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!