Sie sind auf Seite 1von 1

To Construct Matrix A

% To construct matrix A
clear all;
clc;
%---------------------------------------------------------------------% Taking the value of N from user
N = input('How many equations you want to solve:');
%---------------------------------------------------------------------% Defining a matrix A containing zeros of dimension N x N
A = zeros(N,N)
%---------------------------------------------------------------------fprintf ('\nEnter the elements in matrix A in row-wise fashion.');
% Taking elements form matrix A from user
for i = 1:N
for j = 1:N
a = input('Enter the element in the matrix A:');
A(i,j) = a % The zero from ith row and jth column of
% matrix A will get replaced by element a
end
end
disp(A);

Das könnte Ihnen auch gefallen