Plotting the stellar IMF and setting for loop conditions

1 Ansicht (letzte 30 Tage)
HC98
HC98 am 31 Jan. 2020
Hi all, I'm trying to plot the stellar IMF using MATLAB and want to transfer the following Pyhon code:
m = logspace(-2, 2, 400);
def chabrier03individual(m):
k = 0.158 * exp(-(-log(0.08))**2/(2 * 0.69**2))
return numpy.where(m <= 1,\
0.158*(1./m) * exp(-(log(m)-log(0.08))**2/(2 * 0.69**2)),\
k*m**-2.3)
This is my attempt:
%% chabrier03individual
k1=0.158*exp(-(-log(0.08))^2/(2 * 0.69^2))
for j=m
u=0.158*(1./m).*exp(-(log(m)-log(0.08)).^2/(2 * 0.69^2));
end
for m=1
v = k1*m^(-2.3);
end

Antworten (0)

Kategorien

Mehr zu Line Plots 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!

Translated by