Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Specific numbers generation Simulink
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello. Is there any way to generate a sequence of specific numbers with a frequency of generation f_s for example?
0 comentarios
Respuestas (2)
Iain
el 16 de Oct. de 2014
Matlab code for it would be something like... :
listofnumbers = [1 4 7 9];
weight = [1 2 3 4]; % weights, not frequencies... - 9 should appear 4x more than 1, 7 should be 3x, 4 should be 2x...
cw = cumsum(weight);
cw = cw./cw(end);
for i = 1:10
random = rand(1,1);
selected = listofnumbers(min(1:numel(listofnumbers) .* random < cw))
end
1 comentario
Orion
el 18 de Oct. de 2014
Hi,
In the source library, use the Repeating Sequence Stair block.
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!