# lab11.pdf

Description
1 Using MATLAB to generate waveforms, plotting level curves and Fourier expansions. Task 1. CONTENTS 1. 2. 3. Formulation The task for computations Example 1. FORMULATION One of the basic applications of the sine and cosine functions is simple harmonic motion. An object displays harmonic motion if its motion is modeled by a sine or cosine function, y(t) = A sin(ωt + φ) + d or y(t) = A cos(ωt + φ) + d where y is the displacement from a point of reference, usually the rest position, and t is
Categories
Published

View again

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
1 Using MATLAB to generate waveforms, plotting level curves andFourier expansions. Task 1. CONTENTS 1. Formulation2. The task for computations3. Example 1. FORMULATION One of the basic applications of the sine and cosine functions is simple  harmonic motion . Anobject displays harmonic motion if its motion is modeled by a sine or cosine function,  y ( t ) = A sin( ωt + φ )+ d  or  y ( t ) =  A cos( ωt + φ )+ d  where  y  is the displacement from a point of reference,usually the rest position, and  t  is time. The rest position is the place where the object wouldnaturally stay in place; but since the object is actually in motion it is moving though its restposition. Figure 1: Simple Harmonic Motion Many objects have simple harmonic motion. We consider examples which have only simpleharmonic ﬂuctuations (when there is no friction).The interpretation of the characteristics of the sinusoidal wave is: Amplitude   A : the maximum distance from the rest position that the object moves. Period   T  : time it takes the object to complete 1 cycle, a graphical period. Phase Shift  : the time diﬀerence from  t  = 0 to the start of the 1st cycle. The phase shift is usuallynot used unless we are comparing 2 objects in harmonic motion. Vertical Shift  : The distance from the rest position to the reference point, i.e. ground level. Thevertical shift is usually not used since the rest position is usually used as the reference point.A quantity related to the period is  frequency  . The frequency is the number of cycles per timeunit. Thus, if the frequency =  f  , then f   = 1 T   = 1  period  = 12 π/ω  =  ω 2 π  and 2 πf   =  ω. The units for frequency is  hertz  ,1 hertz  = 1 hz  = 1  cyclesecond So while the period is a measure of the amount of time per cycle, the frequency is a measure of the number of cycles per time. Sometimes the functions for simple harmonic motion are written as y  =  a sin(2 fπt  +  φ ) +  d  and  y  =  a cos(2 fπt  +  φ ) +  d  to show the frequency.  2 And now let’s introduce the concept of simple harmonic oscillator.A simple  harmonic oscillator  is an oscillator that is neither driven nor damped. It consists of a mass  m , which experiences a single force,  F  , which pulls the mass in the direction of the point x  = 0 and depends only on the mass’s position  x  and a constant  k . Balance of forces (Newton’ssecond law) for the system is F   =  ma  =  md 2 xdt 2 Solving this diﬀerential equation, we ﬁnd that the motion is described by the function x ( t ) =  A cos( ωt  +  φ ) , where ω  =   km  = 2 πT  . The motion is periodic, repeating itself in a sinusoidal fashion with constant amplitude, A. Inaddition to its amplitude, the motion of a simple harmonic oscillator is characterized by its periodT, the time for a single oscillation or its frequency  f   =  1 T   , the number of cycles per unit time. Theposition at a given time t also depends on the phase,  φ , which determines the starting point onthe sine wave. The period and frequency are determined by the size of the mass m and the forceconstant k, while the amplitude and phase are determined by the starting position and velocity.The velocity and acceleration of a simple harmonic oscillator oscillate with the same frequencyas the position but with shifted phases. The velocity is maximum for zero displacement, while theacceleration is in the opposite direction as the displacement.The potential energy stored in a simple harmonic oscillator at position  x  is U   = 12 kx 2 . A  waveform  is the shape and form of a signal such as a wave moving in a physical medium oran abstract representation.In many cases the medium in which the wave is being propagated does not permit a directvisual image of the form. In these cases, the term ’waveform’ refers to the shape of a graph of the varying quantity against time or distance. An instrument called an oscilloscope can be used topictorially represent a wave as a repeating image on a screen. By extension, the term ’waveform’also describes the shape of the graph of any varying quantity against time.Vector diagrams can be used to refer to  Fourier series . The Fourier series describes the de-composition of periodic waveforms, such that any periodic waveform can be formed by the sumof a (possibly inﬁnite) set of fundamental and harmonic components. Finite-energy non-periodicwaveforms can be analyzed into sinusoids by the Fourier transform. 2. TASK FOR COMPUTATIONS Exercise I Study ﬁrst theoretical introduction to the laboratory work and the deﬁnition of the harmonicoscillator according to ” http  :  //en.wikipedia.org/wiki/Harmonic oscillator ”.It is necessary to simulate harmonic oscillators using MATLAB. To do this, write a program(a MATLAB code) that visualizes functions speciﬁed in the particular task with a given set of parameters (option).You need to identify and demonstrate the changes of graph’s behavior for the variable system pa-rameters (amplitude, frequency, initial phase).1) Create a function  sig 1 =  A 1  sin( πf  1 t ) +  A 2  sin( πf  2 t ) +  A 3  sin( πf  3 t  +  φ ), where  A 1  = 0 . 03, A 3  = 1,  f  2  = 5000,  f  3  = 2000,  φ  =  π 4 . Values  A 2  and  f  1  are given as free parameters, in order tomonitor for changes in graph’s behavior.2) Plot  sig 1 in the interval containing three periods for two diﬀerent values of   A 2 , f  1 , and  φ  of your own.3) Save the plots as two diﬀerent ﬁgures (.jpg ﬁles).4) Make clear ﬁgure captions that indicate the form of the function and values of all parameters.  3 5) Analyze the results in the report using the Example below as a sample text. Exercise II Let F  ( x )  ≈  S  n  =  a 1  sin  πxa  +  a 2  sin  2 πxa  + ··· +  a n  sin  πnxa  = n   j =1 a  j  sin  πjxa  be the ﬁrst  n  terms of the sine Fourier serie for a given function  F  ( x ),  x  ∈  ( − a,a ).For the cosine Fourier serie, G ( x )  ≈  C  n  = n   j =0 a  j  cos  πjxa  For the given  a >  0,  n >  2, and Fourier coeﬃcients  a  j , plot all the graphs of   S  1 , ... S  n , or  C  1 ,... C  n , try to plot all in diﬀerent colors on the same graph. Analyze the results, save the ﬁguresas .jpg ﬁles and make clear ﬁgure captions that specify all the used quantities and parameter values. f  ( x ) =  x, a  =  π, n  = 1 , 2 , 3 , 4.  S  n  =  S  4  = 2sin( x ) − sin(2 x ) +  23  sin(3 x ) −  12  sin(4 x ). Exercise III Determine the periods with respect to  X   and  Y   and plot on the same ﬁgure the level curves of the functions  F  1  and  F  2 . Save ﬁgures as .jpg ﬁles. F  n [ X,Y   ] =  A n  sin( aπX  )cos( b n πY   ),  n  = 1 , 2,  a  = 3,  b 1  = 1,  b 2  = 4,  A 1  = 4,  A 2  = 0 . 5,0  < X <  πa ,  − 4  < Y <  4 for  F  1  and 4  < Y <  8 for  F  2 . 3. EXAMPLE Exercise I  A MATLAB function  sig  =  A 1  cos( πf  1 t ) +  A 2  cos( πf  2 t ) is created using a MATLABcode below.Programm ﬁle:function [ ] = sig(  A 1 ,f  1 ,A 2 ,f  2 ) Create a time vector  t=0:0.05e-3:5e-3; Form the signal vector  sig1 =  A 1 . ∗ (cos(  pi. ∗ f  1 . ∗ t ));sig2 =  A 2 . ∗ (cos(  pi. ∗ f  2 . ∗ t ));sig = sig1 + sig2;sigﬀt = ﬀt(sig); Plot the signal  plot(t,sig,t,sigﬀt); Label graph and axes  title(  sig  =  A 1 cos ( πf  1 t ) +  A 2 cos ( πf  2 t )  );xlabel(  time  );ylabel(  sig  );We ﬁx frequency  f  1  of the ﬁrst oscillation and consider how to change the nature of the resultingmotion by varying the frequency of the second oscillation  f  2 . 1.  f  2  = 0 ( | ∆ f  |  = ¯ f  )The equation of motion has the form y ( t ) =  A 1  cos( πf  1 t ) +  A 2 . This is a harmonic motion with constant frequency  f  1  and a constant amplitude, the equilibriumposition is raised by the value of   A 2  producing  harmonic oscillations  .  4 Figure 2: Graphs of sig and sigﬀt. 2.  f  2  >  0  f  2  << f  1  ( | ∆ f  | ≈  ¯ f  )The equation of motion has the form y ( t ) =  A 1  cos( πf  1 t ) +  A 2  cos( πf  2 t ) . This is a harmonic motion with constant frequency  f  1  whose equilibrium position varies accordingto the harmonic law from  A 1  to  A 2  giving  oscillation with varying equilibrium position  . 3.  f  2  =  f  1 ,  (∆ f   = 0)The equation of motion has the form sig  = ( A 1  +  A 2 )cos( πf  1 t ) . This is a harmonic motion with constant frequency  f  1  and constant amplitude  A 1  + A 2  presenting harmonic oscillations  . 4.  f  2  ≈  f  1  (∆ f   →  0)  | ∆ f  |  <<  ¯ f  The equation of motion has the form y ( t ) =  A ( t )cos(Ω t ) , A 23  =  A 21 A 22  + 2 A 1 A 2  cos(∆ ft ) ,  Ω  →  ¯ f   + 12 A 2  − A 1 A 1  +  A 2 ∆ f. It represents  beating   giving harmonic oscillations at a constant frequency Ω whose amplitude isslowly changing from  | A 1  − A 2 |  to  A 1  +  A 2 . 5.  f  2   =  f  1  (∆ f >  0)  | ∆ f  |  <  ¯ f  . Here we study all cases that are not included in 1-4.The equation of motion has the form y ( t ) =  A ( t )cos( ¯ ft  +  φ ( t )) , A 23  =  A 21 A 22  + 2 A 1 A 2  cos(∆ ft ) , tg ( φ ( t )) =  A 2  − A 1 A 1  +  A 2 tg (12∆ ft ) . It is a motion with variable frequency and variable amplitude, and therefore it is an example of  non-harmonic oscillations  .The described cases have no clear-cut boundaries on the frequency scale and gradually mergeinto one another.All ranges of frequencies in which there is movement of one species are both right and the left of the ﬁxed frequency  f  1 . The extent of areas with the same character of the movement is not iden-tical to the right and to the left of the ﬁxed frequency  f  1  and depend on the values of this frequency. Exercise III [X, Y] = meshgrid(0:0.05: π , -1:0.05:1); F   = 2sin(2 πX  )cos(1 . 5 πY   )(1 − X  2 ) Y   (1 − Y   );mesh(X,Y,F)surf(X,Y,F)colorbarlevels = [0:0.01:0.5];contour3(X, Y, F, levels)colorbar

Jul 23, 2017

#### pepino

Jul 23, 2017
Search
Similar documents

View more...
Tags

Related Search