Plotting the stellar IMF and setting for loop conditions
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (0)
See Also
Categories
Find more on Line Plots 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!