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

5. Create a MATLAB file and generate a geometric sequence using for loop (10 poi

ID: 2073436 • Letter: 5

Question

5. Create a MATLAB file and generate a geometric sequence using for loop (10 points): (a) 4, 8, 12, 16, 20, 24; (b) 38, 32, 26, 20, 14, 8 6. Create a MATLAB file and generate a geometric sequence using colon operator (6 points): (a) 3, 6, 9, 12, 15, 18; (b) 35, 30, 25, 20, 15, 10. 7. Create a MATLAB file and write a code to implement the following: (10 points): (a) Define a 5x5 zero matrix. Name the matrix as ‘A' (use zeros function, see MATLAB help for more information) (b) Use for loop and if statement to transform matrix A into an identity matrix. Call the function "disp" to show your results.

Explanation / Answer

5)a)

********************************************************************

clear all
p=0;
q=0;
for x=1:6
p=p+4;
q=p;
fprintf('%d ',q);
x=x+1;
end

****************************************************************************

SERIES:[4 8 12 16 20 24]

b)

************************************************

clear all
x=1;
p=44;
q=0;
for x=1:6
p=p-6;
q=p;
fprintf('%d ',q);
x=x+1;
end

****************************************************************************************************

series[38 32 26 20 14 8]

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote