Reference no: EM131113344
1. Write a function called year2016 that returns a row-vector of struct-s whose elements correspond to the days of a month in 2016 as specified by the input argument. If the input is not an integer between 1 and 12, the function returns the empty array. Each struct should contain three fields with these (exact) field names: "month", "date", and "day" (all lower case).
• The month field must contain a string with the name of the month (first letter capitalized).
• The date field must contain a scalar specifying the day of the month.
• The day field must contain the three-letter abbreviation of the day chosen from this list: 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'.
For example, here is a call of the function followed by a command that shows the seventh element of the struct array that is returned by the function:
2. A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Write a function that is called this way:
>> n = palin_product (dig, lim);
The function returns the largest palindrome smaller than lim that is the product of two dig digit numbers. If no such number exists, the function returns 0. (Inspired by Project Euler.)
3. Each number on telephone keypads, except 0 and 1, corresponds to a set of uppercase letters as shown in this list:
2 ABC, 3 DEF, 4 GHI, 5 JKL, 6 MNO, 7 PQRS, 8 TUV, 9 WXYZ
Hence, a phone-number specification can include uppercase letters and digits. Write a function called dial that takes as its input argument a string of length 16 or less that includes only these characters and returns as its output argument the telephone number as a uint64. Here is the input and output for one example of a call of the function:
Input: '1FUNDOG4YOU'
Output: 13863644968
You can assume that a phone number never starts with 0. If the input contains any illegal characters, the function returns 0. You are not allowed to use the built-in function strrep.
4. An n-by-n square logical matrix can be represented by a cell vector of n elements where the kth element corresponds to the kth row of the matrix. Each element of the cell vector is a row vector of positive integers in increasing order representing the column indexes of the logical true values in the given row of the matrix. All other elements in the given row of the logical matrix are false. Write a function called logiunpack that takes such a cell vector as its only input and returns the corresponding square logical matrix. For example, such a cell vector representation of a 100-by-100 logical matrix with the only true elements at indexes (10, 20) and (10, 75) would have only one non-empty element of the cell vector at index 10. That element is the vector [20 75].
5. Solve the inverse of the previous problem. That is, write a function called logipack that takes a square logical matrix as its only input argument and returns its cell vector representation as specified in the previous assignment. Note that empty array elements of the cell vector corresponding to rows with all false values must have a size of 0x0.
6. Write a function called digit_counter that takes the name of a text file as input and returns the number of digits (i.e., any of the characters, 0-to-9) that the file contains. If there is a problem opening the file, the function returns -1. WARNING: if you use the ‘w' flag with fopen, as opposed to ‘r', you will overwrite the file. The grader uses your own m files to check your function, so be careful!
7. Write a function called day_counter that returns the number of Mondays that fell on the first day of the month in a given year between 1776 and 2016 inclusive where the requested year is the only input to your function and it is a positive integer scalar. Note that a leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400. In a leap year, February has 29 days. You are not allowed to use the datenum built-in function. (Inspired by Project Euler.)
8. Write function called huge_add that adds together two positive integers of any length specified as strings using decimal notation. The single output argument is the result and it is a string as well. The inputs and output must contain digits only; no commas, spaces or any other characters are allowed. If any of these assumptions are violated by the input, the function returns the number -1.
9. 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. Write a function called smallest_multiple that returns a uint64, the smallest positive number that is evenly divisible by all of the numbers from 1 to n where n is a positive integer scalar and is the only input argument of the function. If the result would be greater than what can be represented as a uint64, the function returns 0. (Inspired by Project Euler.)
What is the interpretation of your results
: Using Exhibit 5.4, calculate the one-, three-, and six-month forward premium or discount for the U.S. dollar versus the British pound using European term quotations. For simplicity, assume each month has 30 days. What is the interpretation of your re..
|
Discuss any three principles of communication
: Take any English newspaper and discuss any three principles of communication with reference to any news item of at least 75 words
|
Increase the space in linux system
: You have just been handed a new IDE hard disk to increase the space in your Linux system. Your goal is to install the IDE hard disk and configure it so it's the master drive on the secondary IDE channel.
|
Determine the frequency of the stator-induced voltage
: The uniform air gap is of length 1 mm, while the armature diameter is 0.5 m, and the axial length of the machine is 1.5 m. The field winding carries a current of 1 A (dc) and the rotor is driven at 3600 r/min.
|
Write a function called year2016 that returns a row vector
: Write a function called year2016 that returns a row-vector of struct-s whose elements correspond to the days of a month in 2016 as specified by the input argument. If the input is not an integer between 1 and 12, the function returns the empty array...
|
Technology-product review for an siem solution
: A client company has asked you to research and recommend a product which will allow them to upgrade or replace their first generation Security Information and Event Management (SIEM) product with a next generation solution that combines real-time ..
|
Prepare the journal entry to record the reimbursement
: Petty Cash The petty cash fund of Teasdale's Auto Repair Service, a sole proprietorship, contains the following. The general ledger account Petty Cash has a balance of $300.
|
Conduct an industry and competitive analysis
: Provide an overview of the companys current performance (in majority of cases this will be financial) - Identify the company's capabilities: using Porter's Value Chain
|
Micro-programmed control unit
: Suppose you wanted to implement a control unit for a computer that you are designing. Would you use a hardwired implementation or a micro-programmed control unit? Why? What factors in the computer design would affect your decision?
|