Write a function in matlab for these parameters
MATLAB Function:
function [nDays, nDates] = weeklyCalendar(days, dates,
shift)
# Function that determines the date in a certain
number of days
# Extracting only days of week (excluding
spaces)
tDays = days(1:2:end);
# New days string
nDays = "";
# New dates
nDates = dates;
# Iterating over days of week
for i = 1:7
# Circular shifting
dates
# If month end
reached
if dates(i)+shift >
30
# Move to month starting and adding number of dates
nDates(i) = dates(i) + shift - 30;
else
# Adding number of dates
nDates(i) = dates(i) + shift;
endif
# Circular shifting
days
# If week end is
reached
if i+shift > 7
# Update from week starting
nDays = [nDays ' ' tDays(i+shift-7)];
else
# Updating days
nDays = [nDays ' ' tDays(i+shift)];
endif
endfor
endfunction
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sample Output:
Write a function in matlab for these parameters (char) A string representing 7 days of the...
for matlab Function Name: vineCompilation Inputs: (char) The first vine quote (char) The second vine quote Outputs: 1. (char) A “compilation” of the vines Background: It’s Sunday afternoon and you’re hanging out in your lounge, finishing off your Sprite Cranberry. Your Mom FriendTM (Jared, 19) walks in and yells at you for drinking soda for breakfast. Aggravated, you YEET the empty can down the hall as Jared drags you to the kitchen to make breakfast. You open the fridge to...
use matlab to solve it 1. Write a function called MyTimeConversion with the following function declaration line. begin code function [Hours, Minutes, Message] = MyTimeConversion (TotalMinutes) end code The input argument TotalMinutes should be a nonnegative scalar integer representing the total number of minutes in a specified time interval. The output arguments Hours and Minutes should be nonnegative scalars such that Hours*60 + Minutes = TotalMinutes and the value of Minutes must be less than 60. The output argument Message...
Suppose that the predicted high temperatures for the next 7 days Express the high temperature 1. given in the table below. are as a function of the day t (day) High temperature, H (degrees F 95 1 2 96 3 97 98 5 99 100 6 7 101 A local shop has determined that the number of bottles of water they sell on a summer day is a function of the day's high temperature, and is approximately given by N...
11. The str_word_count() function returns the number of digits in a string. T/F [?] 12. The term parsing refers to the act of dividing a string into logical component substrings or tokens. T/F [?] 13. The strpos() function performs a case-sensitive search for specified characters in a string and returns the position of the first occurrence of a substring within a string. T/F [?] 14. The strchr() function or strrchr() function return a substring from the specified characters to the...
C Programming Quesition (Structs in C): Write a C program that prompts the user for a date (mm/dd/yyyy). The program should then take that date and use the formula on page 190 (see problem 2 in the textbook) to convert the date entered into a very large number representing a particular date. Here is the formula from Problem 2 in the textbook: A formula can be used to calculate the number of days between two dates. This is affected by...
(1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt) Ex: Enter a sample text: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue! You entered: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews...
1. Write a function in matlab platform for each part as described. a. Obtains the multiplication of elements of n-sized vector, where n is a positive integer. Name of this function must be “all2”. b. Obtains the sum of elements of nxn-sized matrix, where n is a positive integer. Name of this function must be “will3”. c. Obtains the sum of prime factors of an integer. Name of this function must be “be0”. Example (1): Prime factors of 84 are...
Please write the code using matlab 1) i. Create an anonymous function named optimist, that accepts a single variable as input i Create a row vector Tthat represents the number of seconds in two minutes, starting ii. Call the function optimist on the vector T, store the result in variable R1 and returns the double of that variable from one and ending at a hundred and twenty v. Create an anonymous function named pessimist, that accepts a single variable as...
Q1. Write a recursive function in C++ void printNumberedChars(string str, int i=0) { ... } which prints each character of the given string str on a new line, with each line numbered 1, 2, 3, …. For example calling the function with printNumberedChars("hello"); should output the following: 1. h 2. e 3. l 4. l 5. o Q2. Write a recursive function in C++ int sumArray(const int* arr, unsigned int size) { ... } which takes an array of integers,...