How can I store the scalars in array after loop
Mostrar comentarios más antiguos
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;
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!