I wish to limit plotting a point on a single line and not anywhere else on the graph (just on the line) with every input
조회 수: 3 (최근 30일)
이전 댓글 표시
for M1 = 1:1:5
m = m+1;
%================================
% theta-beta-M relation
%================================
Nr = ((M1^2)*((sin(beta_range)).^2))-1;
Dr = ((gamma+(cos(2*beta_range)))*M1^2)+2;
theta = atan(2*cot(beta_range).*Nr./Dr);
%================================
% max. theta for a M1
%================================
% For a given mach number, theta max flow deflection angle for which an
% attached shock is possible.
% max theta for the Mach No.
a(m) = max(theta);
% find the beta for max. theta
b(m) = beta_range(find(theta==a(m)));
plot(theta,beta_range,'-b')
hold on
end
% Mach number downstream of a strong shock will always be sub-sonic
plot(a,b,'-r','Linewidth',1.5)
xlabel('\theta')
ylabel('\beta')
axis([0 42*pi/180 0 pi/2])
% Flow Deflection angle theta Comes from geometry in radian
Theta_r1 = 0.261;
% Flow Deflection angle in degrees
for M1 = 5
Theta_1 = Theta_r1*(180/pi);
fprintf('Flow Deflection angle = %0.2f°\n', Theta_1);
end
% Shock wave angle in radians
beta_r1 = interp1(theta,beta_range,Theta_r1)
% Shock wave angle in radians
Beta_1 = beta_r1*(180/pi);
fprintf('Shock wave angle = %0.2f°\n', Beta_1);
if Theta_r1 < a(m)
fprintf('Weak Shock wave')
else
fprintf('Strong Shock wave')
end
plot (Theta_r1,beta_r1, 'o')
%This is a standard Theta-Beta-Mach Number plot
%The plot this code will generated will have 4 curved lines. Each represents Mach number M1. Outermost being Mach 5. With every input value of theta_r1, I wish to limit plotting the point only on Mach 5 line.
Thanks in advance.
댓글 수: 1
VBBV
2023년 5월 5일
이동: VBBV
2023년 5월 5일
It seems you are converting the Theta and Beta values to degrees which produces out of bound values of the chart and makes it invisible.
m = 0;
% change these range values for different curve
beta_range = linspace(0,pi/2,100);
gamma = 1.4;
for M1 = 1:1:5
m = m+1;
%================================
% theta-beta-M relation
%================================
Nr = ((M1^2)*((sin(beta_range)).^2))-1;
Dr = ((gamma+(cos(2*beta_range)))*M1^2)+2;
theta = atan(2*cot(beta_range).*Nr./Dr);
%================================
% max. theta for a M1
%================================
% For a given mach number, theta max flow deflection angle for which an
% attached shock is possible.
% max theta for the Mach No.
a(m) = max(theta);
% find the beta for max. theta
b(m) = beta_range(find(theta==a(m)));
plot(theta,beta_range,'-b')
hold on
end
xlabel('\theta')
ylabel('\beta')
axis([0 42*pi/180 0 pi/2])
% Mach number downstream of a strong shock will always be sub-sonic
plot(a,b,'-r','Linewidth',1.5)
hold on
% Flow Deflection angle theta Comes from geometry in radian
Theta_r1 = 0.261;
% Flow Deflection angle in degrees
if isequal(M1, 5)
Theta_1 = Theta_r1;
fprintf('Flow Deflection angle = %0.2f°\n', Theta_1);
% Shock wave angle in radians
beta_r1 = interp1(theta,beta_range,Theta_r1)
% Shock wave angle in radians
Beta_1 = beta_r1;
fprintf('Shock wave angle = %0.2f°\n', Beta_1);
if Theta_r1 < max(a)
fprintf('Weak Shock wave')
else
fprintf('Strong Shock wave')
end
% put this line insdie the condition for Mach number = 5
plot (Theta_r1,Beta_1, 'ro','MarkerFaceColor','r')
end
xlim([0 pi/4]); ylim([0 pi/2])
채택된 답변
VBBV
2023년 5월 5일
편집: VBBV
2023년 5월 5일
for M1 = 1:1:5
m = m+1;
%================================
% theta-beta-M relation
%================================
Nr = ((M1^2)*((sin(beta_range)).^2))-1;
Dr = ((gamma+(cos(2*beta_range)))*M1^2)+2;
theta = atan(2*cot(beta_range).*Nr./Dr);
%================================
% max. theta for a M1
%================================
% For a given mach number, theta max flow deflection angle for which an
% attached shock is possible.
% max theta for the Mach No.
a(m) = max(theta);
% find the beta for max. theta
b(m) = beta_range(find(theta==a(m)));
plot(theta,beta_range,'-b')
hold on
end
% Mach number downstream of a strong shock will always be sub-sonic
plot(a,b,'-r','Linewidth',1.5)
xlabel('\theta')
ylabel('\beta')
axis([0 42*pi/180 0 pi/2])
% Flow Deflection angle theta Comes from geometry in radian
Theta_r1 = 0.261;
% Flow Deflection angle in degrees
hold on
if isequal(M1, 5)
Theta_1 = Theta_r1*(180/pi);
fprintf('Flow Deflection angle = %0.2f°\n', Theta_1);
% Shock wave angle in radians
beta_r1 = interp1(theta,beta_range,Theta_r1)
% Shock wave angle in radians
Beta_1 = beta_r1*(180/pi);
fprintf('Shock wave angle = %0.2f°\n', Beta_1);
if Theta_r1 < a(m)
fprintf('Weak Shock wave')
else
fprintf('Strong Shock wave')
end
% put this line insdie the condition for Mach number = 5
plot (Theta_1,Beta_1, 'o')
end
put this line insdie the condition for Mach number = 5
plot (Theta_r1,beta_r1, 'o')
댓글 수: 2
VBBV
2023년 5월 5일
편집: VBBV
2023년 5월 5일
It will plot exactly on the outer curve if you use the code which i gave earlier, See the example demonstration below plotted not for a maximum theta angle
m = 0;
% change these range values for different curve
beta_range = linspace(0,pi/2,100);
gamma = 1.4;
for M1 = 1:1:5
m = m+1;
%================================
% theta-beta-M relation
%================================
Nr = ((M1^2)*((sin(beta_range)).^2))-1;
Dr = ((gamma+(cos(2*beta_range)))*M1^2)+2;
theta = atan(2*cot(beta_range).*Nr./Dr);
%================================
% max. theta for a M1
%================================
% For a given mach number, theta max flow deflection angle for which an
% attached shock is possible.
% max theta for the Mach No.
a(m) = max(theta);
% find the beta for max. theta
b(m) = beta_range(find(theta==a(m)));
plot(theta,beta_range,'-b')
hold on
end
xlabel('\theta')
ylabel('\beta')
axis([0 42*pi/180 0 pi/2])
% Mach number downstream of a strong shock will always be sub-sonic
%plot(a,b,'-r','Linewidth',1.5)
hold on
% Flow Deflection angle theta Comes from geometry in radian
Theta_r1 = 0.161;
% Flow Deflection angle in degrees
if isequal(M1, 5)
Theta_1 = Theta_r1;
fprintf('Flow Deflection angle = %0.2f°\n', Theta_1);
% Shock wave angle in radians
beta_r1 = interp1(theta,beta_range,Theta_r1)
% Shock wave angle in radians
Beta_1 = beta_r1;
fprintf('Shock wave angle = %0.2f°\n', Beta_1);
if Theta_r1 < max(a)
fprintf('Weak Shock wave')
else
fprintf('Strong Shock wave')
end
% put this line insdie the condition for Mach number = 5
plot (Theta_r1,Beta_1, 'ro','MarkerFaceColor','r')
end
xlim([0 pi/4]); ylim([0 pi/2])
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


