how to plot two graphs using a matlab?

1 vue (au cours des 30 derniers jours)
Carc
Carc le 16 Jan 2023
Réponse apportée : Voss le 17 Jan 2023
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

Réponses (1)

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

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by