MATLAB: How can i get a matrix from an array like this: control flowhomework Starting with a = [12 21 32]; I would like to get this: M = [12 21 32; 21 32 12; 32 12 21]; with size and length fun. only Is it some kind of loop??? Best Answer a = [12 21 32 42];n=length(a)M=afor k=1:n-1 c=a(1) a(1:end-1)=a(2:end) a(end)=c M=[M;a]end Related SolutionsMATLAB: Moving average without using movmean() or conv() I'm attaching a fully manual 2-D convolution. It should be easy for you to adapt it to 1-D MATLAB: Write a function [M] = theMax(A), where M is the maximum value in an array A. Don’t use the built-in MATLAB function max. Then write a function (M) = theNMax(A,N) where M is an array consisting of the N largest elements in A using the theMax functi I'm assuming this is a homework assignment, so I won't give you a full answer. Here are some hints as to how you could do it:- initialize M- use myMax(M) to find out if A(i) is greater than the previously stored values in M- if it is, append the new value to M- if M has more than N values, delete the first value Related QuestionError in bit shifting operationImplicit expansion with empty arraysHow to create a customized array and running a counter through itCut differently odd and even rows in matrix
Best Answer