How to write this expression in matlab ? Boolean logic
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
( P ^ Q ) or (~p) (p and q) or ( not p)
I do know that and(p,q) is P ^ q and that or(p,q) is P or Q
but how do I write the one i need ?
0 comentarios
Respuestas (2)
Azzi Abdelmalek
el 18 de Oct. de 2013
You can check yourself
p=[0 0 1 1],
q=[0 1 0 1]
p.^q
and(p,q)
or(p,q)
~p
~q
0 comentarios
Jos (10584)
el 18 de Oct. de 2013
you really should take a look at the logical operators & and | and ~ http://www.mathworks.nl/help/matlab/ref/logicaloperatorselementwise.html
(P & Q) | ~P
0 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!