How to solve the range of x axes and obtain y values?
古いコメントを表示
I wish to obtain figure as shown below:

here, y axis is r and x-axis is unu_f.
I tried to generate unu_f using a range of "r" values from 0:0.2:4 by solving equation z2. But i am getting curve like,

I have tried the following code but it does not produce the required o/p. Can Anyone please help me generating like in panel (a,b)?
clear; close all; clc;
Vau = 43;
theta_u = 71.8;
gamma = 5/3;
Vsu = 47.45;
tic
unu_f = [];
for r = 0:0.2:4
if r>3.9
r = 3.88;
end
syms Unu
A = r*Vau^2*cosd(theta_u)^2;
B = 2*r*Vsu^2/(r+1-gamma*(r-1));
C = r*Vau^2*sind(theta_u)^2;
D = (2*r - gamma*(r-1))/(r+1 - gamma*(r - 1));
x = Unu^2;
z2 = real(double(solve((x - A)^2*(x - B) - C*x*(D*x - A))));
unu_f = [unu_f;z2'];
end
toc
r2 = 0:0.2:3.9;
r1 = 3.88;
r = [r2 r1];
figure;
subplot(2,2,4)
x = abs(unu_f(:,1));
y = r;
yyaxis left
plot(x,y,'ob')
ylim([0 4]); xlim([0 1200]);
ylabel('r (Shock Strength)','FontWeight','bold','FontSize',10);
xlabel('Shock Speed (km/s)','FontWeight','bold','FontSize',10);
box on; grid on;
set(gca,'XMinorTick','on','YMinorTick','on','FontSize',12,'FontWeight','bold')
set(gca,'LineWidth',2.25,'TickLength',[0.010 0.010],'YColor',[0 0 0]);
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!