Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Mechanical Engineering Expert

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.)

Mechanical Engineering, Engineering

  • Category:- Mechanical Engineering
  • Reference No.:- M91870925
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in Mechanical Engineering

Fluid mechanics assignment - viscous flow in pipesq1 as

Fluid Mechanics Assignment - Viscous Flow in Pipes Q1. As shown in the figure below, water "bubbles up" 3 in. above the exit of the vertical pipe attached to three horizontal pipe segments. The total length of the 0.75-i ...

Problem -a long pipe od 1413 mm id 1318 mm kp 20 wmk

Problem - A long pipe (OD = 141.3 mm, ID =131.8 mm, k p = 20 W/m.K) supplies hot pressurized liquid water at 400 K to a heater in a factory. The pipe has an insulation thickness of 100 mm. A new efficient heater replaces ...

Materials behaviour from atoms to bridges assignment -

Materials Behaviour from Atoms to Bridges Assignment - Distributed loads and static equilibrium (Please note: you should show your steps with necessary figures) Q1. Two beam sections are jointed at C and supported at A b ...

Alocate ten minutes for the presentationuse audio visual

Allocate ten minutes for the presentation Use audio / visual / technological supports / aids where appropriate Use a minimum of 3 properly referenced articles. THEMES PRESENTATION TOPIC MEMORY Discuss the three learning ...

Life cycle assessmentfor your chosen service eg white

LIFE CYCLE ASSESSMENT For your chosen service (e.g. white board markers), identify two alternatives of getting the service (e.g. brand A, brand B). Choose the most environmentally friendly option by conducting life cycle ...

The aim of the project is to demonstrate certain aspects of

The aim of the project is to demonstrate certain aspects of engineering materials in different applications. The projects will be assessed on the basis of a written Research Report. The report should clearly show what yo ...

Heat transfer and combustionyou will need graph paper a

HEAT TRANSFER AND COMBUSTION You will need graph paper, a calculator, a copy of Appendix 1 from lesson HTC - 4 - 2 and access to steam tables to answer this TMA. 1. A fuel gas consists of 75% butane (C 4 H 10 ), 10% prop ...

Mechanical engineering assignment task - solve the given

Mechanical Engineering Assignment Task - Solve the given problem. Task 1 - A spring with a one-turn loop of 40mm mean radius is formed from a round section of wire having 5 mm diameter. The straight tangential legs of th ...

Question - truss structureconsider the three membered

Question - Truss Structure Consider the three membered planar truss structure shown in the figure below. All members of the truss have identical square cross-sectional area (A) of 25 mm x 25 mm, and Youngs Modulus (E) = ...

Questions -q1 a qualitative estimate of the effect of a

Questions - Q1. A qualitative estimate of the effect of a wind-tunnel contraction (Figure) on turbulent motion can be obtained by assuming that the angular momentum of eddies does not change through the contraction. Let ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As