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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!