Write a MATLAB function func1 which takes a matrix A as argument then add 5 in each element of matrix A and store the result in B matrix then pass matrix B to func2 which will show the matrix B.
Posted in matlab
No comments
Wednesday, July 30, 2014 By Anonymous
Write
a MATLAB function func1 which takes a
matrix A as argument then add 5 in
each element of matrix A and store the result in B matrix then pass matrix B to func2 which will show the matrix B.
Solution:
Rows=input(‘Enter rows for a matrix:’);
Coloumns = input(‘Enter coloms
for matrix B:’);
MatA = zeros(Rows,Columns);
for i=1 : 1 : Rows
for j=1 : 1 : Columns;
fprontf(‘ Enter value
in row %d Column %d = ‘, i,j);
MatA(i,j) = input(‘’);
end
end
MatB=func1(MatA);
Func2(MatB);
end
func1:
function [Argument_MatB]
= func1(Parameter_MatA)
Argument_MatB = Parameter_MatA + 5;
end
func2:
functoin
func2(Parameter_matB)
disp(parameter_MatB);
end
Related posts
Share this post
0 comments: