How can I store the scalars in array after loop
显示 更早的评论
m
I would like to save all the scalars from the loop (pcf, pc, ph) in 1-D arrays. Size of X is 100.
u1=18.877;
sigma1=0.411;
mu2=22.263;
sigma2=0.246;
mu3=22.961;
sigma3=0.635;
x=linspace(17,28);
pmd=normpdf(x,mu2,sigma2);
pld=normpdf(x,mu1,sigma1);
pud=normpdf(x,mu3,sigma3);
s=pmd+pld+pud;
for i=1:size(x)
pcf(i)=pmd(i)/s(i);
pc(i)=pld(i)/s(i);
ph(i)=pud(i)/s(i);
end
pcf;
pc;
ph;
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!