How to write this expression in matlab ? Boolean logic
조회 수: 16 (최근 30일)
이전 댓글 표시
( 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
답변 (2개)
Azzi Abdelmalek
2013년 10월 18일
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
Jos (10584)
2013년 10월 18일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!