Question

In Matlabexplain how MMAIDAB gou that ansWer! 8. Perform row operations: The three elementary row operations can be performed in MATLA

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Type I:

MATLAB CODE:

clc
clear all
close all

A = [4 2 3;-8 -7 -2;12 -9 34];

fprintf('Matrix A:\n')
disp(A)

S = size(A);
m = S(1); % Number of rows in matrix A

fprintf('NOTE:Matrix A is having %d rows only\n',m)

i = input('Enter row number for i:');
j = input('Enter row number for j:');

A([i,j],:) = A([j,i],:);
fprintf('Matrix after Rows %d and %d are interchaned:\n',i,j)
disp(A)

OUTPUT:

Matrix A: 4 2 3 8 12 9 34 NOTE:Matrix A is having 3 rows only Enter row number for i: 2 Enter row number for j: 3 Matrix afte

Type II:

MATLAB CODE:

clc
clear all
close all

A = [4 2 3;-8 -7 -2;12 -9 34];

fprintf('Matrix A:\n')
disp(A)

S = size(A);
m = S(1); % Number of rows in matrix A

fprintf('NOTE:Matrix A is having %d rows only\n',m)

i = input('Enter row number for i:');
a = input('Enter any number for a:');

A(i,:) = a*A(i,:);
fprintf('Matrix after Row %d multiplied by %d:\n',i,a)
disp(A)

OUTPUT:

Matrix A: 2 4 8 12 3 934 NOTE : Matrix A is having 3 rows only Enter row number for i: Enter any number for a: 5 Matrix after

Type III:

MATLAB CODE:

clc
clear all
close all

A = [4 2 3;-8 -7 -2;12 -9 34];

fprintf('Matrix A:\n')
disp(A)

S = size(A);
m = S(1); % Number of rows in matrix A

fprintf('NOTE:Matrix A is having %d rows only\n',m)

i = input('Enter row number for i:');
j = input('Enter row number for j:');
a = input('Enter any number for a:');
A(i,:) = A(i,:) + a*A(j,:);
fprintf('Matrix after Row %d is multiplied by %d and added to Row %d:\n',j,a,i)
disp(A)

OUTPUT:

Matrix A: 4 3 8 2 12 9 34 NOTE: Matrix A is having 3 rows only Enter row number for i: Enter row number for j: 3 Enter any nu

Add a comment
Know the answer?
Add Answer to:
In Matlab explain how MMAIDAB gou that ansWer! 8. Perform row operations: The three elementary row operations can be per...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MATLAB ONLY gauss.jpg BELOW Instructions: The following problems can be done interactively or by writing the...

    MATLAB ONLY gauss.jpg BELOW Instructions: The following problems can be done interactively or by writing the commands iın an M-file (or by a combination of the two). In either case, record all MATLAB input commands and output in a text document and edit it according to the instructions of LAB 1 and LAB 2. For problem 2, include a picture of the rank-1 approximation. For problem 3, include a picture of the rank-10 approximation and for problem 4, include a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT