Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a newfunctionnamedLastName_FirstName_Flipper.m(with your name) withthe fo

ID: 3861420 • Letter: C

Question

Create a newfunctionnamedLastName_FirstName_Flipper.m(with your name) withthe following inputs and outputs:function [numFlips] = LastName_FirstName_Flipper()The variable specications are as follows:numFlipsA number that indicates the number of coin ipsNote the function has no inputs.In the function, write a while-loop that ips a coin" and counts the number of ips ittakes to ip a heads".To simulate ipping a coin, use therand()function to generate a random number between0 and 1. If the number is greater than 0.5, then assume that you have ipped a heads".Here is some sample code to get your started:

Explanation / Answer

Call the function at the command prompt using the variables x and y.

Call the function using values instead of variables. The inputname function returns an empty char array because its input does not have a name.

Create the following function in a file, myfun2.m, in your current working folder.

Call the function at the command prompt.

Call the function using a field of y. Because the input argument contains dot indexing, the inputname function returns an empty char array for the second variable name and all subsequent variable names.

Call the function using the second cell of x. Because the input argument contains cell indexing, the inputname function returns an empty char array for the first variable name and all subsequent variable names.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote