필터 지우기
필터 지우기

how to add two binary digits of 8bit size?

조회 수: 1 (최근 30일)
Mohit  Nanduri
Mohit Nanduri 2021년 11월 29일
댓글: Rik 2021년 11월 30일
input1 : 8 bit binary digit
input2 : 8 bit binary digit
output : 8 bit binary digit and carry should be stored in another variable
  댓글 수: 2
Mohit  Nanduri
Mohit Nanduri 2021년 11월 29일
should not use inbuilt functions. Please help me with this code
Rik
Rik 2021년 11월 29일
This homework question is poorly phrased. It is very difficult to do anything in Matlab without using builtin functions.

댓글을 달려면 로그인하십시오.

채택된 답변

Chunru
Chunru 2021년 11월 29일
편집: Chunru 2021년 11월 29일
a = '01001011';
b = '00100011';
c = '00000000';
% Cosider a carry bit
carry = 0;
% loop through from last bit to first bit
% add the bit from a and b and the carray
% update the results for the current bit and the carry bit
  댓글 수: 4
Mohit N
Mohit N 2021년 11월 30일
@Rik actually this is not my homework or assignment please try to understand I am trying to run the output wihtout use of inbuilt functions previously u said that without using built in operators we can't do anything but I got the answer from @Chunru. please try to help @Rik but don't give negative comments.
Rik
Rik 2021년 11월 30일
The answer Chunru gave used the plus operator if I recall correctly. That is a builtin function.
Also, if it isn't homework, why would you limit yourself? Is there some part of binary addition you don't understand and want to do by hand?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by