Assign loop values into each rows

조회 수: 5 (최근 30일)
Yuling CAO
Yuling CAO 2016년 9월 19일
편집: Andrei Bobrov 2016년 9월 19일
Hi, I built a loop and want to assign each H12 and H34 result when i=1:600 into each rows? Can someone give me a code?
tsteps = 600; % timesteps
for i = 1:tsteps
% calculate autospectra
sp11 = conj(p1(i,:)).*p1(i,:);
sp33 = conj(p3(i,:)).*p3(i,:);
% calculate cross spectrum.
sp12 = conj(p1(i,:)).*p2(i,:);
sp34 = conj(p3(i,:)).*p4(i,:);
% calculate transfer function
H12 = sp11(i)./sp12(i);
H34 = sp33(i)./sp34(i);
end

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2016년 9월 19일
sp11 = conj(p1).*p1;
sp33 = conj(p3).*p3;
sp12 = conj(p1).*p2;
sp34 = conj().*p4;
H12 = sp11./sp12;
H34 = sp33./sp34;

태그

Community Treasure Hunt

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

Start Hunting!

Translated by