how to plot two graphs using a matlab?

1 次查看(过去 30 天)
Carc
Carc 2023-1-16
回答: Voss 2023-1-17
I am trying to plot lots of data in one figure, but I can't plot my last one(wattdis).
The plot for equation 'wattdis' can not be plotted in my figure. Could you point out what errors I have in my code?
data = readtable('dataform');
x1 = data.incidentenergy1;
x2 = data.incidentenergy2;
U238_MT102 = data.U238_MT102 * 516.79*10^-6;
U238_MT18 = data.U238_MT18 * 516.79*10^-6;
U238_MT2 = data.U238_MT2 * 516.79*10^-6;
C12_MT2 = data.C12_MT2 * 8.216*10^-2;
U235_MT18 = data.U235_MT18 * 3.799 * 10^-6;
U235_MT102 = data.U235_MT102 * 3.799 * 10^-6;
maxwell = (2 .* pi / (pi .* 0.026/10.^6).^3/2) .* (x1.^1/2) .* exp(-x1/(0.026/10.^6));
wattdis = 0.4865 .* (x1.^1/2) .* ((2.* x1).^1/2) .* exp(-x1); %% Watt distribution
loglog(x1,U238_MT102);
grid on
hold on
loglog(x1,U238_MT18)
loglog(x1,U238_MT2)
loglog(x2,C12_MT2)
loglog(x2,U235_MT18)
loglog(x2,U235_MT102)
title('cross section')
xlabel('Incident energy(MeV)')
ylabel('Macroscopic cross sectiob(b)')
legend('U238 MT=102','U238 MT=18','U238 MT=2','C12 MT=2','U235 MT=18','U235 MT=102')
yyaxis right;
semilogx(x1, maxwell)
yyaxis left;
semilog(x1, wattdis) %% I cannot plot this one.
holf off

回答(1 个)

Voss
Voss 2023-1-17
semilog should be semilogx, and holf should be hold
% semilog(x1, wattdis) %% I cannot plot this one.
semilogx(x1, wattdis)
% holf off
hold off

类别

Help CenterFile Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by