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 次查看(过去 30 天)
{% 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

采纳的回答

Iddo Weiner
Iddo Weiner 2017-3-20
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 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by