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

THIS IS MATLAB Please answwer if you know matlab well. I need help with my code

ID: 3793425 • Letter: T

Question

THIS IS MATLAB Please answwer if you know matlab well. I need help with my code solve it.

This is a half-adder logical circuit: This circuit performs a very basic version of binary addition. It has two input bits, A and B, and two output bits S (Sum) and C (Carry). S is A XOR B. C is A AN D B. Write a function with two boolean inputs and two boolean outputs, S and C, that recreates the half-adder. function [S, C] = halfAdd(A, B) function [comments] = graderater(your grade) %our output for this function will be a string with comments, and the input %should also be a string with the capitalized letter grade switch(yourgrade) %start switch/caes with what you are examining case 'A' %case by case, define the output comments = 'Excellent!'; case 'B' comments = 'Well done'; case 'C' comments = 'Eh'; case 'D' comments = 'Not great:/'; case 'F' comments = 'Keep trying!'; otherwise comments = 'Invalid grade'; end end

Explanation / Answer

%SUM = A xor B
%CARRY = A and B

function [S,C] = halfadd(A,B)

S = bitxor(A,B);
C = bitand(A,B);

end