Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please do in MATLAB, Homework 2 In this homework assignment you will create one script m-file, which will be divided into three sections (one for

Please do in MATLAB,

image text in transcribed

image text in transcribed

Homework 2 In this homework assignment you will create one script m-file, which will be divided into three sections (one for each problem), and three function m-files (No.1 and No.2). But you will submit only one file: the *.pdf document created when you publish the script m-file Since you may need to use a user defined function in No. 1,2 and 3, in each section of the script m-file vou will have a statement that looks like this: type functionname where functionname is the name of the function m-file called within that section. For example, if in Problem 1 you have a function printLine2 that resides in a function m-file printLine2.m, the following line should appear in the first section of your script m-file type printLine2 This statement causes the code in the file printLine2.m to be printed in the published document This is important for the following reason. If there is no statement like this in the script m-file that gets published, then the only code that will get published will be the code in the script m-file itself. In this case, the code in your function m-files will not appear in your published document. Therefore, there would be no way for your instructor to properly evaluate your work. 1. Prepare a function m-file containing a function that prints a line (to the command window), where the line consists of a string, the value of a (scalar) unsigned integer, and the values of the elements in a vector. All these components should print on one line with white space between the different components. (5pts) The input will be a cell array. The first cell will contain the string. The second cell will contain the (scalar) unsigned integer having class uint8. The third cell will contain the vector of class double. This function should work if the vector is of length 1, 2, 3, or 4. There will be no output variables. For example, A- {'red', uint8 (100), [0,0.2,0.4));% Your cell array input red: 100 0.0 0.2 0.4 % Print after running your function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions