How to write this expression in matlab ? p ^ q ^ r
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I do know that p ^ q is and(p,q) . But not sure what p q and r is
Thank you
0 comentarios
Respuestas (3)
Walter Roberson
el 14 de Oct. de 2013
[P, Q, R] = ndgrid([0 1]);
truthtable = P & Q & R;
[P(:), Q(:), R(:), truthtable(:)] %display it
0 comentarios
Jan
el 14 de Oct. de 2013
Or perhaps:
for p = [false, true]
for q = [false, true]
for r = [false, true]
result = p & q & r;
disp([p, q, r, result])
end
end
end
This is Walter's solution broken down to simple loops.
0 comentarios
Ver también
Categorías
Más información sobre Functions 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!