Question

For each of the following Matlab codes, fill in each cell of the empty template with TWO VALUES: (1) A NUMERICAL VALUE that a

clear:ele B (3,3)-O for row1:3 for col-1:3 if (mod (row col,3)2) elseif (mod (row+col,3)0) elseif (mod (row+col,3) 1 B (row,c
For each of the following Matlab codes, fill in each cell of the empty template with TWO VALUES: (1) A NUMERICAL VALUE that appears in that cell of the matrix; and (2) A WORD identifying the COLOR that appears in that cell, as a result of the matrix being interpreted as an image using Matlab's IMAGESC command. Examples: "Red", "Green", "Cyan", etc. DO NOT PUT THE MATLAB RGB COLOR CODE IN THE CELL! That is, instead of the word "Red", DO NOT enter "100" into the cell! The word is what is required, AND NOT THE RGB code
clear:ele B (3,3)-O for row1:3 for col-1:3 if (mod (row col,3)2) elseif (mod (row+col,3)0) elseif (mod (row+col,3) 1 B (row,col) -2: B (row, col) -3 B(row , col ) -1; end end end mycolornap = [1。0; 1 1 0 o o 11 colormap (mycolormap) imagesc (B) axis square
0 0
Add a comment Improve this question Transcribed image text
Answer #1

clear;clc;close all;
B(3,3) = 0;

for row = 1:3
for col = 1:3
if (mod(row+col,3)==0)
B(row,col) = 3;
elseif (mod(row+col,3)==1)
B(row,col) = 2;
elseif(mod(row+col,3)==2)
B(row,col) = 1;
end
end
end

mycolormap = [0 0 1;1 0 0; 1 1 0];
colormap(mycolormap)
imagesc(B)
axis square

% filling the empty template

template{3,3} = [];
colors = {'blue','red','yellow'}; %long names for RGB triplet in mycolormap

for row = 1:3
for col = 1:3
if (mod(row+col,3)==0)
template{row,col} = {B(row,col),colors{B(row,col)}};
elseif (mod(row+col,3)==1)
template{row,col} = {B(row,col),colors{B(row,col)}};
elseif(mod(row+col,3)==2)
template{row,col} = {B(row,col),colors{B(row,col)}};
end
end
end

Variables-template | B x1 template X | template(1,1) 3x3 cell 4 1 1x2 cell 2 1x2 cell 3 1x2 cell 1x2 cell 1x2 cell 1x2 cell x

豔Variables-template( 1、1) B X| template X1 template(1,1) ΧΙ 1x2 cell 4 blue

B template template(1, 1) template 3, 3 1x2 cell 4 yellow

COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER,

IF YOU'RE SATISFIED, GIVE A THUMBS UP

Add a comment
Know the answer?
Add Answer to:
For each of the following Matlab codes, fill in each cell of the empty template with TWO VALUES: ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Exereise 5 (4 pts) The following MATLAB pattern detector scans image matrix A for TWO DIFFERENT P...

    Exereise 5 (4 pts) The following MATLAB pattern detector scans image matrix A for TWO DIFFERENT PATTERN TYPES, as indicated by the form of the IF/ELSEIF construction. Each pattern's count is recorded separately, and stored either in the variable counterA or in the variable counterB. What are the final values stored in variables counterA and counterB when the follow ing MATLAB pattern detector program finishes execution? Circle each pattern type found in matrix A. Please use two different colors, one...

  • Please show all handwritten steps Exercise 4 (2 pts): When run, the following MATLAB code produces...

    Please show all handwritten steps Exercise 4 (2 pts): When run, the following MATLAB code produces one of the four images shown below. Circle the image that is produced by the MATLAB code: (SHOW WORK!) clear:clc A (5, 5) 0 mycolormap= [10 0; 0: 011 colormap (mycolormap) for m 1:5 for n = 1:5 A (m, n) mod (m+n, 5) end end imagesc (A) axis square A) B) c) D)

  • For each of the below codes, determine if the following MATLAB codes produces an error. •...

    For each of the below codes, determine if the following MATLAB codes produces an error. • If the code does NOT produce an error, predict the output. • If the code DOES produce an error: (1) state what line the FIRST error is found and what the error is ICE08B-1: clear;clc SICE08B-1 A = [1,5,2,9,4,9]; B(1,5) = 0; counter = 1; for i = 1:length(A) B(1) = A(i) * counter; B(1) = B(i)-2; counter = counter + 1; end ICE08B-2:...

  • matlab please Problem 1. PART A Create a cell array called ca that will contain the following: [Physics] [14][1 4 -...

    matlab please Problem 1. PART A Create a cell array called ca that will contain the following: [Physics] [14][1 4 -3 8] [ITim] [Burnett]] [23] [Jessica] [Wul] [3 9 17] [Chemistry] [8 7 2 91 [Literature] [IJavier] [Lopez] [54] As shown above, the cell array ca should contain within the cells of each row: a department name (eg. Physics), integer code (e.g., 14), an array of integers (e.g., [1 4-3 8]), and two sub-cells containing a person's first and last...

  • For each of the below codes, determine if the following MATLAB codes produces an error. If...

    For each of the below codes, determine if the following MATLAB codes produces an error. If the code does NOT produce an error, predict the output. If the code DOES produce an error: (1) state what line the FIRST error is found and (2) what the error is clear;clc %ICE08B-1 A = [1,5,2,9,4,9]; B(1,5) = 0; counter = 1; for i = 1:length(A)     B(i) = A(i) * counter;     B(i) = B(i)-2;     counter = counter + 1; end

  • Do the following using Matlab: Let A be a matrix where each row corresponds to an...

    Do the following using Matlab: Let A be a matrix where each row corresponds to an article, and each column to how often a specific word appears in the article. Patterns among the articles and words can often be identified by analyzing the singular values and vectors of the singular value decomposition of A. (a) Use the Matlab svd function to find the singular values of the following . Note this problem does not ask you to print out the...

  • In Python, starting with the 8x8 board solution that will be appended here add the following...

    In Python, starting with the 8x8 board solution that will be appended here add the following functionality: 1) Add code to create a list, containing 8 lists, with each of the 8 lists containing 8 null strings as values. Call the list of lists board. code provided by prof: import turtle validMovesList=['A0','A2','A4','A6','B1','B3','B5','B7', 'C0','C2','C4','C6','D1','D3','D5','D7', 'E0','E2','E4','E6','F1','F3','F5','F7', 'G0','G2','G4','G6','H1','H3','H5','H7','quit'] def drawSquare(t,length,color): t.fillcolor(color) t.begin_fill() for num in range(4): t.forward(length) t.left(90) t.end_fill() def drawRow(t,length,color1,color2): for i in range(4): drawSquare(t,length,color1) t.forward(length) drawSquare(t,length,color2) t.forward(length) def drawCircleFilled(t,size,color): t.fillcolor(color) t.begin_fill()...

  • whats the answers How many total integers elements are in an array with 4 rows and...

    whats the answers How many total integers elements are in an array with 4 rows and 7 columns? 07 28 11 What is the resulting array contents, assuming that itemList is an array of size 4 having contents -55, -1, 0, 9? for (i = 0; i < 4; ++i) { itemsList[i] - i; -54,0, 1, 10 O 0, 1, 2, 3 O 1, 2, 3, 4 O-55,-1, 0,9 Given an integer array myVals of size N_SIZE (i.e. int[] myVals...

  • Need help starting from question 9. I have tried multiple codes but the program says it is incorrect. Case Problem 1 Da...

    Need help starting from question 9. I have tried multiple codes but the program says it is incorrect. Case Problem 1 Data Files needed for this Case Problem: mi pricing_txt.html, mi_tables_txt.css, 2 CSS files, 3 PNG files, 1 TXT file, 1 TTF file, 1 WOFF file 0 Marlin Internet Luis Amador manages the website for Marlin Internet, an Internet service provider located in Crystal River, Florida. You have recently been hired to assist in the redesign of the company's website....

  • Question:Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) Matlab question Matrix Notation Interpreter (matrix elements to cell array of formatted character...

    Question:Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) Matlab question Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) A system of linear algebraic equations can be writen in matrx notation by applying the definizion of matrix multiplication. For example, the linear system Can be writen as or where and x = 2 matrix input ror the variable A and a × T e function command dennes the output variable linearSystem Code has...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT