Monday, August 31, 2015

Quadrants of a matrix in Matlab

Intention of the program is to take the scalar as the argument names n and to return the matrix of size 2nx2n. Such that the elements of the matrix will be like The elements of the submatrix in the top left corner are all 1s the elements of the submatrix at the top right are 2s the elements in the bottom left are 3s and the elements in the bottom right are 4s.

function [Q] = quadrants(n)
Q = [ones(n) ones(n)+1 ; ones(n)+2 ones(n)+3];
end

No comments:

Post a Comment

DC motor control with Pulse Width Modulation Part 1

DC Motor intro DC motor is a device which converts electrical energy into kinetic energy. It converts the DC power into movement. The typica...