Hi! I have a loop which gives me vectors of length=50. How can i create a loop, so it will make 5 of these vectors? This just gives me one vector on length=250. How can I make so it will be 5 vectors?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Christoffer Sørensen
el 20 de Mzo. de 2017
Respondida: Iddo Weiner
el 20 de Mzo. de 2017
{% loop over temperatures for i=1:1:5 for t = temperatures % for i=1:1:5% Step temperatur from 0 to max in steps of 0.1 [E, SE] = mcsteps(100*size*size, t, 0.0, 1.0); % non-interacting spins %[E, SE] = mcsteps(100*size*size, t, 1.0, 0.0); % interacting spins
% Gradually build a vector of mean energies and one of mean spin
% excesses.
E_mean = [E_mean mean(E)];
SE_mean = [SE_mean ; mean(SE)];
% plot state at each t in temperature vector
% figure(10)
% plotstate(t)
% end
end end
0 comentarios
Respuesta aceptada
Iddo Weiner
el 20 de Mzo. de 2017
How about create a 5*50 matrix and fill it with 2 loops?
data1 = rand(5);
data2 = rand(50);
out = zeros(5,50);
for idx1 = 1:5
for idx2 = 1:50
out(idx1,idx2) = data1(idx1) * data2(idx2);
end
end
imagesc(out)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!