logo for matrixlab-examples.com
[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Welcome Matrixmania Blog
-> Sitemap / Search <-
-> Books <-
Forums and Help
Contact
Basics Quick Matlab Guide
Matlab Tutorial
Matlab Examples
Matlab Flow Control
Boolean Logic
Plots and GUI Matlab 2D Plots
Matlab 3D Plots
Matlab GUI
Applications Calculus
Linear Algebra
Matlab Cookbook I
Matlab Cookbook II
Electrical Calculations
Probability and Stats
Finance Apps
Other Relevant Links
Notes on Computing
Online Calculators
Fun!
Your own Website?
Terms/Policies
leftimage for matrixlab-examples.com

Logical NOT


In MATLAB, ~A performs a logical NOT of input array A, and returns an array containing elements set to either logical 1 (TRUE) or logical 0 (FALSE). This is the truth table and the representation of a NOT Gate as it's represented in digital electronics.


A    ~A
0      1
1      0
not gate - example in Matlab
This is a logical NOT gate, as represented in electronic circuits


An element of the output array is set to 1 if A contains a zero value element at that same array location.  Otherwise, that element is set to 0.



Example 1:
If matrix A is:
A =

     0     0     1     1
     1     1     0     0
     0     0     0     0
     1     1     1     1

Then, the NOT A is produced:

>> ~A

ans =

     1     1     0     0
     0     0     1     1
     1     1     1     1
     0     0     0     0



Example 2:
If vector x is:
x = 0     1     2    -3     0

Then, the NOT x is produced:

>> ~x

ans = 1     0     0     0     1


 From 'Logical NOT' to home
 From 'Logical NOT' to 'Boolean Algebra'
 
Top

Logical AND

Logical OR

XOR gate

De Morgan's Laws




footer for logical not page