Plotting the stellar IMF and setting for loop conditions

1 view (last 30 days)
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

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!