Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Cosine Wave Values (using varargin) My Solutions > The general mathematical model used describe an AC (alternating current) voltage signal is a cosine wave of

image text in transcribedimage text in transcribedimage text in transcribed

Cosine Wave Values (using varargin) My Solutions > The general mathematical model used describe an AC (alternating current) voltage signal is a cosine wave of the form: V = A cus (1) where A is the amplitude in volts, w is the radian frequency in radians/second, t is time in seconds, and is the phase shift in radians. The period T of the wave is related to the radian frequency by T = 2x Write a function named AcVoltageModel that uses the cosine wave model above to generate voltage values corresponding to 200 equally-spaced time values ranging from 0 to a specified number 1 of wave periods (i.e. the end time value is riperions XT. Use the varargin variable in the input list to accept the following input arguments (in order) that specify the parameters of the signal. Assign default values to the parameters based on the number of cells in varargin. 1. The number of periods to use for the time domain, periods 2. An optional second input of the amplitude, A. Accept this variable into varargin and use a default value of A = 1.0 volt. 3. An optional third input of the radian frequency, m. Accept this variable into varargin and use a default value of m= 2 radians/second. 4. An optional fourth input of the phase shift, . Accept this variable into varargin and use a default value of 0 = 0) radians. Assume the function will be called with the optional input values specified in one of the following four cases: 1. No optional inputs. 2. Value for A is included second in the input list. 3. Values for A and w are listed second and third respectively. 4. Values for A, w, and are listed second, third, and fourth respectively. Your function should output two column vectors (in order): 1. A vector of evenly spaced time values ranging from 0 to "rola X7 2. A vector of voltage values corresponding to the time values. Note the function command is given in line 1 with suggested names for the input and output variables. You can change the names (but not the order) of these variables if you like. Do not change the name of the function, however, as this exact name is required for the tests to run. Be sure to assign a value to the output variable. Function Save e Reset DE MATLAB Documentation 1 function (timeValues, voltageValues] = ACVoltageModel (NumPeriods, varargin) Code to call your function e Reset 1 numPeriods = 2; Amplitude = 119; Volts omega = 2#pi*60;&radians/second 4 Buse default value for phase shift, phi 5 [timeValues, voltageValues] = ACVoltageModel (numPeriods, Amplitude, omega) Run Function Assessment: Run Pretest Submit > Is first output correct for example inputs 2, 110, and 120*pi? (Pretest) > Is second output correct for example inputs 2, 110, and 120*pi? (Pretest) Are both outputs correct for a function call using default values for omega and phi? Are both outputs correct for a function call using all default values? Are both outputs correct for a function call with all four input arguments? Cosine Wave Values (using varargin) My Solutions > The general mathematical model used describe an AC (alternating current) voltage signal is a cosine wave of the form: V = A cus (1) where A is the amplitude in volts, w is the radian frequency in radians/second, t is time in seconds, and is the phase shift in radians. The period T of the wave is related to the radian frequency by T = 2x Write a function named AcVoltageModel that uses the cosine wave model above to generate voltage values corresponding to 200 equally-spaced time values ranging from 0 to a specified number 1 of wave periods (i.e. the end time value is riperions XT. Use the varargin variable in the input list to accept the following input arguments (in order) that specify the parameters of the signal. Assign default values to the parameters based on the number of cells in varargin. 1. The number of periods to use for the time domain, periods 2. An optional second input of the amplitude, A. Accept this variable into varargin and use a default value of A = 1.0 volt. 3. An optional third input of the radian frequency, m. Accept this variable into varargin and use a default value of m= 2 radians/second. 4. An optional fourth input of the phase shift, . Accept this variable into varargin and use a default value of 0 = 0) radians. Assume the function will be called with the optional input values specified in one of the following four cases: 1. No optional inputs. 2. Value for A is included second in the input list. 3. Values for A and w are listed second and third respectively. 4. Values for A, w, and are listed second, third, and fourth respectively. Your function should output two column vectors (in order): 1. A vector of evenly spaced time values ranging from 0 to "rola X7 2. A vector of voltage values corresponding to the time values. Note the function command is given in line 1 with suggested names for the input and output variables. You can change the names (but not the order) of these variables if you like. Do not change the name of the function, however, as this exact name is required for the tests to run. Be sure to assign a value to the output variable. Function Save e Reset DE MATLAB Documentation 1 function (timeValues, voltageValues] = ACVoltageModel (NumPeriods, varargin) Code to call your function e Reset 1 numPeriods = 2; Amplitude = 119; Volts omega = 2#pi*60;&radians/second 4 Buse default value for phase shift, phi 5 [timeValues, voltageValues] = ACVoltageModel (numPeriods, Amplitude, omega) Run Function Assessment: Run Pretest Submit > Is first output correct for example inputs 2, 110, and 120*pi? (Pretest) > Is second output correct for example inputs 2, 110, and 120*pi? (Pretest) Are both outputs correct for a function call using default values for omega and phi? Are both outputs correct for a function call using all default values? Are both outputs correct for a function call with all four input arguments

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago