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
- Plot the following MATLAB functions: y = 3x+2 with x = 0, 0.25, 0.5, ...., 7.75, 8
- MATLAB function that takes a matrix as argument and then ask from the user
- MATLAB program which computes the mean and standard deviation of the data. Use FOR LOOPs.
- Plot the following MATLAB functions y = ln(exp(x^-1)) with x = 1, 1.5, 2, ..., 4
- Plot the following MATLAB functions: y = exp(-x^2) with x = 0, 0.1, 0.2, ..., 2
Share this post
0 comments: