MATLAB: How can i create a 400 by 400 matrix with a pattern MATLABmatrix The matrix is 400 by 400 and i need a -1 2 -1 pattern starting with 2. Like this: Best Answer full(gallery('tridiag', 400))If the subdiagonal, diagonal and superdiagonal were anything other than -1, 2, 1, for example: 1, 2, 3 respectively:fulll(gallery('tridiag', 400, 1, 2, 3))Another way:toeplitz([2, -1, repelem(0, 398)]) Related SolutionsMATLAB: Separating Matrix by Column By Pattern Sounds very easy:starttime = datetime(2018, 9, 10); %whatever your start issampletime = starttime + hours(0:size(sample, 2)-1);issampleweekend = isweekend(sampletime);sampleweekday = sample(:, ~issampleweekend);sampleweekend = sample(:, issampleweekend);A loop is certainly not needed. MATLAB: How to find color pattern Your values are negative so they show up as black because imshow() expects floating point color images to be the in the range 0-1 and anything below 0 is black and anything above 1 is white. Here's a workaround to scale your data using mat2gray():realColor = mat2gray(real(Color));imagColor = mat2gray(imag(Color));figure(2)imshow(realColor);figure(3)imshow(imagColor);title('vertical fringes'),impixelinfo; Related QuestionTensor product of three matricesDivide 73×400 matrix into 73 1×400 matrices
Best Answer