Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Write a MATLAB function that takes a matrix, two row numbers and a scalar as

ID: 3554121 • Letter: 1

Question

1) Write a MATLAB function that takes a matrix, two row numbers and a scalar as arguments and returns a matrix with a linear combination of the rows. For example, if the rows passed to the function were i and j and the scalar was a, each element of row j would become a aik + ajk , where k represents columns 1 through the number of columns in the matrix.


2) Write a function called DNAcomplement that consumes a set of letters as a character array that form a DNA sequence such as 'gattaca'. The function will produce the complement of the sequence so that a's become t's, g's become c's, and vice versa. The string 'gattaca' would therefore become 'ctaatgt'. You may assume that all the letters in the sequence will be lowercase and that they will all be either a,t,g, or c.


*I NEED REAL PROGRAMMING ANSWERS, NO LINKS, PLEASE AND THANK YOU!!!!

Explanation / Answer

CODE FOR THR FIRST QUESTION

// Input of the matrix should be of the form:

number of rows=2

number of columns=3

input=[2 4 6; 4 5 7]


CODE:

clc;

row=input('Enter the number of rows of the matrix');

col=input('Enter the number of colums of the matrix');

m=zeros(row,col);

m=input('Enter the matrix');

a=input('Enter the value of the parameter');

i=input('Enter the first row number');

j=input('Enter the second row number');

for k=1:col

m(i,k)=m(i,k).*a+m(j,k);

end

display(m);


CODE FOR THE SECOND QUESTION


CODE:

clc;

str1=input('Enter the first string');

str2=input('Enter the second string');

str3=input('Enter the third string');

m1=str2num(str1);

m2=str2num(str2);

m3=str2num(str3);


len=length(m1);

m=zeros(1,len);

for i=1:len

m(i)=m1(i)+m2(i)+m3(i);

end

display(m);


CODE FOR THE THIRD QUESTION

// Input of the matrix should be of the form:

number of rows=2

number of columns=3

input=[2 4 6; 4 5 7]


CODE:

clc;

row=input('Enter the number of rows of the matrix');

col=input('Enter the number of colums of the matrix');

m=zeros(row,col);

m=input('Enter the matrix');

a=input('Enter the value of the parameter');

n=input('Enter the row number you want to update');

for i=1:col

m(n,i)=m(n,i).*a;

end

display(m);