Добавил:
sabzeee
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Зачоть / create_matrix
.m %Make matrix size N, give the rule a(i,j)=pi+kj+L , where p,L,K are const.
% diagonal has same elements equal d
%sample A(i,j)=i+j+1 N=6, d=5
function A=create_matrix(N)
for i=1:N
for j=1:N
if (i==j)
A(i,i)=5 %put your value of the diagonal "d"
else
A(i,j)=i+j+1 %given equation or vector
end
end
end
A;
end
% diagonal has same elements equal d
%sample A(i,j)=i+j+1 N=6, d=5
function A=create_matrix(N)
for i=1:N
for j=1:N
if (i==j)
A(i,i)=5 %put your value of the diagonal "d"
else
A(i,j)=i+j+1 %given equation or vector
end
end
end
A;
end
Соседние файлы в папке Зачоть