b) Prepare a Matlab m-file function that will speed up your work in the laboratory. This program is a variation on one p

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

b) Prepare a Matlab m-file function that will speed up your work in the laboratory. This program is a variation on one p

Post by answerhappygod »

B Prepare A Matlab M File Function That Will Speed Up Your Work In The Laboratory This Program Is A Variation On One P 1
B Prepare A Matlab M File Function That Will Speed Up Your Work In The Laboratory This Program Is A Variation On One P 1 (226.35 KiB) Viewed 54 times
b) Prepare a Matlab m-file function that will speed up your work in the laboratory. This program is a variation on one prepared for last week's lab. You should be able to create this program based on our previous use of Matlab in earlier Lab Sessions. (You may want to review the Matlab Supplement from Week #6.) Matlab function m-files begin with the following statement format in their 1st line: function (output1, output2...]=function_name ( input_paraml, input_param2 ,....) , 4 Creating and plotting a sampled cosine signal function waveform = myCos (frequency, phase, duration, Fs) Your function should perform the following operations: 1. Accept 4 parameter arguments (input variables), to specify the cosine frequency (in Hz), phase angle (in radians), duration of signal (in seconds), and the sampling rate (in samples / second). 2. Determine the sampling interval and number of samples needed from the input parameters. 3. Create an array of sample time values (in seconds), for the full signal duration, beginning at sample time 0. 4. Create the values of a 1 volt amplitude (2 V peak-to-peak) cosine function at the specified frequency, for the sample times in your time array; based on your parameters. Be sure to include the phase shift. 5. Return the waveform sample values. (Whatever variable in your function matches the "output" variable specified in the beginning in the "function" definition will be passed back to the Matlab command window (or other calling function) when the end of your file is reached.) 6. Include comments to describe what your program does (for future reference)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply