This solution is outdated. To rescore this solution, sign in.
-
3 Comments
Ramsey Kropp
on 31 Aug 2015
There has to be a better way
mec
on 10 Oct 2015
This one works on matlab but not here
function a = checkerboard(n)
theta=pi/2:pi/2:n*pi/2;
a = (sin(theta)'*sin(theta))+cos(theta)'*cos(theta);
end
Rohan Shingade
on 13 Mar 2016
hey mec.The function you which you have created gives negative one's(data type double) in the upper triangular and lower triangular part whereas the output should be all positive so first convert to data type integer using int function then convert to one's and zero's using logical.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!