1 Write a code for repmat the only builtin commands you are

1. Write a code for repmat; the only built-in commands you are allowed to use are input, size, and disp.

Solution

repmat for representing array patterns.

Syntax: repmat(Array, m, n);

example 1:   Input two rows and 3 columns in repmat

repmat(Array,2,3)

Array=2;

repmat(Array, 2,3)    [2 2 2 2 2 2 ]

Example 2: To count array

a=[1,2;3,4]

repmat(a,1,3);

[1 2 1 2 1 2 3 4 3 4 3 4]

Example3:

let us say y have M,N dimensional data points and you want to center then around the origin.

M=1000;

N=10;

data=rand(M,N); mu=mean(M,N);

replicated_mean=repmat(mu,M,1);

centered_data=data-relicated_mean;

here we use input and find size and display functions.

1. Write a code for repmat; the only built-in commands you are allowed to use are input, size, and disp.Solutionrepmat for representing array patterns. Syntax:

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site