필터 지우기
필터 지우기

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?

조회 수: 2 (최근 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