MATLAB / Octave Tutorial : Generating various signals
Chapter 4: Generating various signals Part 1: Generating Simple Signals Welcome all to a whole new chapter of learning MATLAB / Octave. I know its been a long time since we have hoisted any new chapter. So, lets start with something interesting. In this chapter we will learn how to create simple signal forms like sine, cosine and square waves. Let's start with some math first. We'll be defining a function as follows: y=sin(2πft) (1) Where, f=Frequecy of the signal and t= time range In MATLAB / Octave, sin takes argument in radians. So, we have to convert frequency in Hertz to radians per second. Now we write the following lines of code to generate a sine signal of 100Hz. If we plot the signal, it will look something like this: Quite bizzare, right! Yes, that’s what a 100Hz signal looks like in a 0 to 1s scale. Now, lets analyse each line of code in detail. f=100 ...