matlab roblem 1110pts Write a MATLAB function called duplicate elements.m. The i
ID: 3348990 • Letter: M
Question
matlab
roblem 1110pts Write a MATLAB function called duplicate elements.m. The input argument is a matrix. The function is to systematically duplicate the elements of that matrix and return/output the resultant matrix. Below are two cases that show the desired outputs for two given input matrices. [1 4 5 6] input [1 input = output-[ 2 2 output - [ 2 2 3 3 1 2 2 3 3 1 2 2 3 3 4 4 5 5 6 6 4 4 5 5 6 6] Now write a program called run duplicate elements.m. In the program, make use of the function that you created to test the two cases shown in the above. In other words, you are to hard code the input arguments, use your function to generate the outputs and display the outputs in the command windowExplanation / Answer
clc;
clear all;
close all;
a=input('enter the matrix:');
b=input('enter the order of rows of the new matrix:');
c=input('enter the order of columns of the new matrix:');
u = repelem(a,b,c);
disp(u)
when executed :
enter the matrix:[1 2;3 4]
enter the order of rows of the new matrix:1
enter the order of columns of the new matrix:2
1 1 2 2
3 3 4 4
>>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.