Question
write a function that generates and plots a cosine as above, which takes the following arguments (input parameters) and produces the following outputs: function x
write a function that generates and plots a cosine as above, which takes the following arguments (input parameters) and produces the following outputs: function x = plotsinusoid(f,a,startT,endT,step) where f is the frequency of the cosine, a is the amplitude, startT and endT the start and end times in sec, and step gives the sample period (reciprocal of sampling rate). x is the generated cosine signal. As a hint to see how functions work, here is a two-line m-file expsig.m that generates (although doesnt plot) an exponential signal for a series of integers n running from 0 to N-1: Its that simple! NOTE: THE M-FILE SHOULD BE SAVED UNDER THE SAME NAME AS THE FUNCTION Use the functions xlabel and ylabel to give the axes labels Time (sec) and Amplitude. Run the function from the command line with parameters f,a,startT,endT,step of your choosing (different from above), and reproduce the command and resultant plot in your report. IMPORTANT: make a folder on your computer to contain all the files you will make, and GO THERE in Matlab. Before you leave SAVE everything from that folder on a memory stick or email it to yourself.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started