Convert vector loop to matrix loop
조회 수: 2(최근 30일)
There is a loop for working with a vector, can it be made to work with a matrix?
% in the c(1) loop this is because the loop is for the first column,
% in the matrix loop it should be c(num)
I will be glad to any advice
DGM 2022년 2월 22일
편집: DGM 2022년 2월 22일
You mean like this?
c = rand(1,900);
x = zeros(100,900);
y = x;
for k = 1:99
x(k+1,:) = x(k,:) + 0.4*cos(20)/0.226*pi + c;
y(k+1,:) = y(k,:) + 0.64*sin(78)./x(k,:)*pi + c;
... but I should ask how you say it's working when it's clearly dividing by zero and creating an entire array of Infs