<< Chapter < Page Chapter >> Page >
(a) Adding Outputs, (b) Choosing Data Types

Finally, add numeric indicators in a similar fashion as indicated earlier. [link] shows the completed block diagram and front panel.

(a) Completed Block Diagram, (b) Completed Front Panel

Building a signal generation system using hybrid programming

In this section, let us see how to generate and display aperiodic continuous-time signals or pulses in the time domain. One can represent such signals with a function of time. For simulation purposes, a representation of time t size 12{t} {} is needed. Note that the time scale is continuous while computer programs operate in a discrete fashion. This simulation can be achieved by considering a very small time interval. For example, if a 1-second duration signal in millisecond increments (time interval of 0.001 second) is considered, then one sample every 1 millisecond and a total of 1000 samples are generated for the entire signal. This continuous-time signal approximation is discussed further in later chapters. It is important to note that there is a finite number of samples for a continuous-time signal, and, to differentiate this signal from a discrete-time signal, one must assign a much higher number of samples per second (very small time interval).

Continuous-Time Signals

[link] shows two continuous-time signals x1 ( t ) size 12{x1 \( t \) } {} and x2 ( t ) size 12{x2 \( t \) } {} with a duration of 3 seconds. By setting the time interval dt to 0.001 second, there is a total of 3000 samples at t = 0,0 . 001 , 0 . 002 , 0 . 003 , . . . . . . . , 2 . 999 size 12{t=0,0 "." "001",0 "." "002",0 "." "003", "." "." "." "." "." "." "." ,2 "." "999"} {} seconds.

The signal x1 ( t ) size 12{x1 \( t \) } {} can be represented mathematically as follows:

x1 ( t ) = { 0 0 t < 1 1 1 t < 2 0 2 t < 3 size 12{x1 \( t \) = left lbrace matrix { 0 {} # 0<= t<1 {} ## 1 {} # 1<= t<2 {} ## 0 {} # 2<= t<3{} } right none } {}

To simulate this signal, use the LabVIEW MathScript functions ones and zeros . The signal value is zero during the first second, which means the first 1000 samples are zero. This portion of the signal is simulated with the function zeros(1,1000) . In the next second (next 1000 samples), the signal value is 2, and this portion is simulated by the function 2*ones(1,1000) . Finally, the third portion of the signal is simulated by the function zeros(1,1000) . In other words, the entire duration of the signal is simulated by the following .m file function:

x1=[ zeros(1,1/dt) 2*ones(1,1/dt) zeros(1,1/dt)]

The signal x2 ( t ) size 12{x2 \( t \) } {} can be represented mathematically as follows:

x2 ( t ) = { 2t 0 t < 1 2t + 4 1 t < 2 0 2 t < 3 size 12{x2 \( t \) = left lbrace matrix { 2t {} # 0<= t<1 {} ## - 2t+4 {} # 1<= t<2 {} ## 0 {} # 2<= t<3{} } right none } {}

Use a linearly increasing or decreasing vector to represent the linear portions. The time vectors for the three portions or segments of the signal are 0:dt:1-dt , 1:dt:2-dt and 2:dt:3-dt . The first segment is a linear function corresponding to a time vector with a slope of 2; the second segment is a linear function corresponding to a time vector with a slope of -2 and an offset of 4; and the third segment is simply a constant vector of zeros. In other words, simulate the entire duration of the signal for any value of dt by the following .m file function:

x2=[2*(0:dt:(1-dt)) -2*(1:dt:(2-dt))+4 zeros(1,1/dt)].

[link] and [link] show the block diagram and front panel of the above signal generation system, respectively. Display the signals using a Waveform Graph (Controls Express Waveform Graph) and a Build Waveform function (Function Programming Waveform Build Waveform) . Note that the default data type in MathScript is double precision scalar. So whenever an output possesses any other data type, one needs to right-click on the output and select the Choose Data Type option. In this example, x1 and x2 are double precision one-dimensional arrays that are specified accordingly.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, An interactive approach to signals and systems laboratory. OpenStax CNX. Sep 06, 2012 Download for free at http://cnx.org/content/col10667/1.14
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'An interactive approach to signals and systems laboratory' conversation and receive update notifications?

Ask