Plotting the stellar IMF and setting for loop conditions

1 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by