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

Please use basic MATLAB functions and processes to implement the code for the fo

ID: 3808233 • Letter: P

Question

Please use basic MATLAB functions and processes to implement the code for the following problems. Please read instructions carefully and include well detailed comments so that I can follow each step. Thank you in advance.

2. Congruence Classes (25 points) Write a function that takes as parameters three numbers. The first number is the congruence class. The second number is the modulus, i.e., the number we divide by, and the third number is the cutoff. For example, congruence 1,2,10) finds all members of the congruence class of 1 modulo 2 less than 10, which in this case is (starting from 1) 11, 3, 5, 7, 9). As you can notice, any element divided by 2 will have remainder 1. Another example is congruence(0,3,15). In this case, we return to, 3, 6, 9, 12 One final example is congruence(3, 10, 100). In this case, we return 13, 13, 23, 33, 43, 53, 63,73,83, 93.

Explanation / Answer

function an = congruence(a,b,c)
%initializing the vector
an = [];
while(a<c)
% we start by adding a. a%b is anyways a always.
an = [an a];
% we add b in each iteration to get %b same.
a = a+b;
end
end
congruence(1,2,10);