# Combinational logic - Basic Applications of Boolean Gates

### Experiments with electronic gates

 Logic circuits can be divided into two major sections: combinational logic and sequential logic. The main difference is that the first type of circuit logic doesn’t depend on time or sequence of movements, and the second type of logic does. A clear example to understand this difference can be illustrated by showing the two locks below:

 Combinational Logic Sequential Logic

The lock on the left has four discs that can be rotated separately. When the notches are aligned, the metal hook is released. The only one condition needed is that the appropriate four notches are aligned, no matter if the left disc is set before the one on the right. The lock will open if you have the correct combination.

On the contrary, the lock on the right has only one knob, and the combination could be 3cw – 52ccw – 20cw. This means that one must first get to number 3 going clockwise, then to 52 counterclockwise, and finally get to number 20 clockwise. If you use the same numbers in different order, the lock won’t open. This is a sequential lock, a correct sequence is important.

Due to its stability, reliability, low maintenance and ease at reading digital displays, these days everything is going the digital way.

Logic circuits can be simulated with the so called boolean or logic gates. This is kind of Digital Electronics 101...

Let’s say that we’d like to find out the behavior of the following combinational circuit:

We can create an m-file to effortlessly solve the logic circuit, like this:

function f = combination(x)
% x(1) = A
% x(2) = B
% x(3) = C
% Symbol ~ is used for NOT gates

% We have 4 logic-AND gates
and1 = ~x(1) & ~x(2) & ~x(3);
and2 = ~x(1) & x(2) & ~x(3);
and3 = ~x(1) & ~x(2) & x(3);
and4 = ~x(1) & x(2) & x(3);

% We have 1 logic-OR gate
f = and1 | and2 | and3 | and4;

We can test our function for this specific example of combinational logic:

% These are all the possible combinations for 3 inputs
M = [ 0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1];

% We give all the combinations, one at a time
for i = 1 : 8
comb_log(i) = combination(M(i, :));

end

% We display the results
comb_log

The results are:

comb_log = 1 1 1 1 0 0 0 0

If you make some analysis using the DeMorgan laws, you can conclude that this function can also be simplified to F = not(A), and you can visualize it from the results...

This means that we have not only a MATrix LABoratory, but we've got also a circuit logic simulator!

From 'Combinational Logic' to home

From 'Combinational Logic' to 'Boolean Algebra'

 Top And Gate Or Gate Not Gate Boolean Operators Xor Gate

## Related pages

scilab plotcalculate scrap value of carquadratic formula a b cbissection methodwinspicehow to draw in matlabhex to dec tableoctal codeascii values for azascii value of alphabetsmatlab import excelspecial characters ascii valuesgauss jordan inverse matrixbinary to decimal algorithmnormal standard distribution calculatormaking graphs in matlabbinary convert to octalexponential decay half life formulasum of harmonic series formuladeclare function matlabcalculus integral calculatorbinary hexadecimal tablecoordinate conversionsexponential regression functionmaclaurin series for cosxgauss jordan calculator onlinecalculator integralsintegrate in matlabgaussian elimination matlab codeconverter hex to binaryhow to find node voltagesine expansion formulaamorization tablesdefine integral calculatorcompounded continuously calculatoraverage annual depreciation of a cargraphing piecewise functions calculatorquadratic formula a b cscilab examplewhat is the prime factorization for 49binary to decimal stepsmatlab string concatrc circuit calculationboolean algebra axioms and theoremsconvert octal to binary calculatorfor loop matrix matlabsin matlab degreesdisplay string in matlabhow to define a piecewise functiononline quadratic equation solversquare function in matlabmatlab gui for image processingplot mean and standard deviation matlabdivision of two polynomialsif statement in matlab examplesolve polynomial in matlabmatlab plot circlematlab plot animationohms law pie charthow to calculate residual value of an assetmatlab if statementstep functions in matlabcompounding continuously calculatorsquare feet to inches calculatordecimal to binary algorithmmatlab fzeroohm law calcfminsearchsalvage prices for carssolve simultaneous equations calculator onlinematlab gui for image processingrc circuit differential equationmath lab tutorialrecursive function tutorialoctal to binary examples