Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Call formats shown are for Matlab, but I need this implemented in C, seperated into files as shown on the right. Any help is appreciated,

Call formats shown are for Matlab, but I need this implemented in C, seperated into files as shown on the right. Any help is appreciated, thanks.image text in transcribed

Learn to use "structures" in For this program, calculate a "running mean value in which the input signal is provided in fired-length blocks of "blocksize" samples at a time. For each call to the function, your program should accept a new input sample block, and provide the corresponding output sample block giving the calculated results (assuming all input blocks follow each other). Every sample of the returned output block should contain the mean value of the most recent "M" samples of the input sequence (even if some of the M samples includes values from previous input blocks). Use a structure to store the required information for the calculation from one call to the next The returned mean-value sequence should be the average value of the input sequence measured over the most recent M samples. If z[n] denotes the nth input sample, the output sequence y[n) should be M -1 y[n] = r[n ] running_rrean.h: Should contain structure and function declarations. These entries describe the re- quired interface to the various routines. This file should NOT include and variable definitions or exe- cutable code. It should not reserve or allocate any memory running_rrean.c: Should contain the actual function definitions needed to perform the mean-value computations. Usually, at least three functions are defined: One initialization routine to create the mean-value data structure, allocate any required memory, and initialize variables: A second routine which performs the actual calculations (analogous to the Matlab routine calc_running_nean() in Task 1); and a third routine which is called at program termination to cleanly de-allocate any memory which was previously reserved. Generally, this file should avoid performing any I/O. Use print statements only for debugging pur poses, or for issuing an error message if execution is being terminated.) labl.c The file containing your main program definition. For this task, this file should exercise your mean-value routines to demonstrate the function interface and to verify that the routines produce the expected results. To do this, first create a function "init_running_mean" with a call format given by s = init_running_mean (M, blocksize); Here, "M" is the number of samples to average over in calculating the output value, and blocksize is the input sample block size that will be used in subsequent calls. The returned structure "s" should contain all information needed to perform the calculation in subsequent calls (a copy of M, any required storage arrays, etc.). The output samples should be calculated for one input block at a time by a companion routine "calc_running_mean" with a call format given by [y,s] = calc_running_mean(x, s); The input "X" should be a vector of blocksize new input samples, and the calculated result "y" should be the corresponding blocksize samples of the output signal. The structure "s" is used as both an input and output argument, and may be modified by the function. However, the amount of storage required by the structure s should not increase as calc_running_mean is repeatedly called. Learn to use "structures" in For this program, calculate a "running mean value in which the input signal is provided in fired-length blocks of "blocksize" samples at a time. For each call to the function, your program should accept a new input sample block, and provide the corresponding output sample block giving the calculated results (assuming all input blocks follow each other). Every sample of the returned output block should contain the mean value of the most recent "M" samples of the input sequence (even if some of the M samples includes values from previous input blocks). Use a structure to store the required information for the calculation from one call to the next The returned mean-value sequence should be the average value of the input sequence measured over the most recent M samples. If z[n] denotes the nth input sample, the output sequence y[n) should be M -1 y[n] = r[n ] running_rrean.h: Should contain structure and function declarations. These entries describe the re- quired interface to the various routines. This file should NOT include and variable definitions or exe- cutable code. It should not reserve or allocate any memory running_rrean.c: Should contain the actual function definitions needed to perform the mean-value computations. Usually, at least three functions are defined: One initialization routine to create the mean-value data structure, allocate any required memory, and initialize variables: A second routine which performs the actual calculations (analogous to the Matlab routine calc_running_nean() in Task 1); and a third routine which is called at program termination to cleanly de-allocate any memory which was previously reserved. Generally, this file should avoid performing any I/O. Use print statements only for debugging pur poses, or for issuing an error message if execution is being terminated.) labl.c The file containing your main program definition. For this task, this file should exercise your mean-value routines to demonstrate the function interface and to verify that the routines produce the expected results. To do this, first create a function "init_running_mean" with a call format given by s = init_running_mean (M, blocksize); Here, "M" is the number of samples to average over in calculating the output value, and blocksize is the input sample block size that will be used in subsequent calls. The returned structure "s" should contain all information needed to perform the calculation in subsequent calls (a copy of M, any required storage arrays, etc.). The output samples should be calculated for one input block at a time by a companion routine "calc_running_mean" with a call format given by [y,s] = calc_running_mean(x, s); The input "X" should be a vector of blocksize new input samples, and the calculated result "y" should be the corresponding blocksize samples of the output signal. The structure "s" is used as both an input and output argument, and may be modified by the function. However, the amount of storage required by the structure s should not increase as calc_running_mean is repeatedly called

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

More Books

Students also viewed these Databases questions