Azzera filtri
Azzera filtri

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 visualizzazione (ultimi 30 giorni)
{% 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

Risposta accettata

Iddo Weiner
Iddo Weiner il 20 Mar 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)

Più risposte (0)

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by