instrumentation and measurements

Post on 12-Jan-2017

45 Views

Category:

Engineering

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

“UNIVERSITY OF ENGINEERING AND TECHNOLOGY”

“ABBOTTABAD CAMPUS”

“INSTRUMENTATIONS AND MEASUREMENTS”

“LAB MANUAL”

“SEMESTER – 5”

“LIST OF LABS”

1. Implementing simple calculator in labview.

2. Computing formulas in labview.

3. Loops and if statements.

4. Implementing tables in labview.

5. Automatic lights switching in labview.

6. Traffic lights control in labview.

7. Water level control.

8. Automatic gear selector.

9. Image processing.

10.Audio signal processing.

11.Arithmetic operations on signals.

12.Noise and filtering.

LAB # 01“IMPLEMENTING SIMPLE CALCULATOR IN

LABVIEW”

TASK:

Make a simple calculator using labview.

TOOLS:

Numeric controls. Numeric indicator. Case structure. Enum. Add operator. Subtract operator. Multiply operator. Divide operator. Square operator. Square root operator.

FRONT PANEL:

The front panel of the project includes the:

1. Numeric controls: This tool is used to input numbers to perform different operations on them.

2. Enum: This tool contains list of operations. The user can switch between different options to select operation.

3. Numeric indicator: This tool is used to display results.

BLOCK DIAGRAM:

The block diagram shows the development steps of project. The block diagram window has the:

1. Numeric indicators. 2. Case structure.

The case structure decides the true case in each operation. The case structure contains the gain block for each operation. Then the numeric indicator is connected at the other end to display the results. The enum selects the operation of the user’s choice.

RESULT:

LAB # 02

“COMPUTING FORMULAS IN LABVIEW”

TASK 1:

Find the power factor of the following power triangle diagram using labview.

The formula for power factor is given as:

TOOLS:

Numeric controls. Numeric indicators. Multiply. Divide. Cos. Formula.

PROJECT DEVELOPMENT :

The project development steps are as follows:

FRONT PANEL:

The front panel only contains:

1. Numeric Controls: To input the value for V and I to be used in the formula of power factor.2. Numeric Indicators: To display the results of power factor in each case.

The front panel is as follows:

BLOCK DIAGRAM:

The block diagram contains:

1. Numeric indicators: They show the result of the calculation.2. Numeric controls: They are used to input the values for voltage and current. They are

actually used from the front panel.3. Gain: There are two types of gain used. One is multiply and other is divide since the

calculations require multiplication and division of certain terms.4. Formula: It is used to build or input some formula that will automatically be calculated and

will generate the results.5. Cos: This element is used to find the cos of some value being input to it.

TASK 2:

Prove the Pythagoras theorem using labview.

Pythagoras theorem states that:

“In a right angled triangle the square of the hypotenuse is equal to the sum of the squares of the other two sides.”

So let us assume a triangle with the following lengths:

Base = 3cm

Hypotenuse = 5cm

Perpendicular = 4cm

Then, the labview implementation will have the following arrangement. Square the inputs for base and perpendicular and add them together and take the square root at the end. The result will give the length of hypotenuse of the given triangle.

FRONT PANEL:

The project is simple with two inputs and one output. For input numeric controls are used and for out a numeric indicator is used.

BLOCK DIAGRAM:

The block diagram has the square gain to square the values of base and perpendicular of triangle. Then the add gain adds up the squared values and finally the square root gain takes the root of the end result and sends to the numeric indicator to display.

TASK 3:

Implement the following temperature conversion formulas in labview.

1. Centigrade to Fahrenheit.2. Fahrenheit to centigrade.3. Centigrade to kelvin.

The conversion formulas for temperature are as follows:

Centigrade to Fahrenheit:

Fahrenheit to Centigrade:

Centigrade to Kelvin:

FRONT PANEL:

BLOCK DIAGRAM:

The block diagram contains the numeric controls for inputting the temperature. The temperature value is being fed to formula block which contains the conversion formula for each type of conversion. Then the result is being displayed on numeric indicator.

The conversion for the given input of 20 for each type generates the following results when calculated manually using a calculator.

200C=2930K

200F=-6.666660F

200C=680F

Comparing the results with labview model, it can be seen that the results are correct.

LAB # 03

“LOOPS AND IF STATEMENTS IN LABVIEW”

LOOPS:

Loops are a set of statements which are to be executed several times or are to be repeated again and again with different values.

In C++ programming, there are three types of loops, namely;

1. While loop.2. For loop.3. Do while loop.

WHILE LOOP:

The syntax of while loop is;

The while loop is used when it is not sure that when the loop is to be stopped. So a condition is placed in the while condition. The loop continues till the condition in the code is true. When the condition becomes false, the loop stops execution. The coding inside while loop will never be executed if the condition comes to be true.

FOR LOOP:

The for loop has the following syntax;

Where i is the loop counter and x is the number of times the loop will be executed. The for loop is used when the number of terms a loop is executed is known.

DO WHILE LOOP:

The syntax for do while loop is;

The do while loop resembles the while loop. The only difference is that the statements inside the do while loop will be executed at least once even if the condition for while is found to be false.

LOOPS IN LAB VIEW:

The loops used in C++ programming can be implemented in labview via block diagrams. The procedure for implementation is as follows:

WHILE LOOP:

The block diagram representation of while loop in labview is as given below:

This symbol in the diagram of while loop is named to be “ loop iteration”. It tells us the number of times a loop has been executed.

This symbol in the diagram is the representation of “loop condition”. It decides when the loop is to be stopped. We can create a control with this condition symbol to manually control the execution of certain loop.

The option of while loop can be found in labview by the following steps;

Go to function palette and select the programming option. Then go to structures and select while loop.

FOR LOOP:

The for loop is represented by the following symbol in lab view;

This symbol is named to be “loop iteration” and functions the same as in case of while loop.

This symbol is named to be “loop count”. The number of times we want the loop to be executed is fed to this terminal of the loop. The loop executes up to that value.

The for loop is found in the labview as follows:

IF-ELSE STATEMENT:

It is the conditional statement in which we use different conditions inside same block. The if statement decides which block of statements to enter for execution. The compiler executes the statements or set of statements when if condition is found true. If the condition is found to be false, then the else block is executed.

The syntax for if statement is as given below:

IF-ELSE STATEMENT IN LABVIEW:

The if statement in labview is listed as “case structure”. The diagram for case structure is as follows:

By default, there are only two conditions either true or false. If the required condition is found true, the true block is executed. If the condition is found to be false, the block in the false condition is executed.

This block is named to be “case label”. It is the block in which the conditional cases are added. There is at least one default case for each condition. For each condition, there is a separate block diagram. The input and output is common for each condition.

This block is called as “case selector”. This block selects the case to be executed.

TASK-1:

Using while loop implement a model in labview which inputs a random number and then multiply it with some nominal temperature and display it on a thermometer scale.

FRONT PANEL:

The front panel of the model contains a

Thermometer: The thermometer shows the changes occurring in temperature on the scale. Loop Control: The loop control is a manual control which allows to stop the loop whenever

wanted.

The front panel appears to be as follows:

BLOCK DIAGRAM:

The block diagram of the model contains:

Random Number: the random number is set of numbers ranging from 0-1. It is found in the following block of elements.

Numeric Constant: It is a constant number. It is being used as a multiplication factor with the random number to range it from 1-10. It is also being used to add the random number with some nominal temperature value.

Gain: Two types of gain are being used. One is multiplication and other is addition. While Loop: The while loop block executes the function of the block diagram continuously

until being interrupted by the control switch which is connected to the loop condition.

The block diagram of the model is as follows:

RESULTS:

The results of the above model generate a constantly changing temperature ranging from 250-350. The results are as follows:

TASK-2:

Multiply two numbers using while loop and determine the number of times the loop has been executed.

FRONT PANEL:

The front panel of the model has the following blocks:

Loop Control: The loop control is a stop button to stop the loop execution whenever desired.

Numeric Display: One numeric display displays the results of the multiplication of the entered numbers. The other display outputs the results of the number of times the loop has been executed.

BLOCK DIAGRAM:

The block diagram contains the following:

Numerical Constants: The numerical constants are two numbers being multiplied. Gain: The gain block is the multiplication of the numbers. While Loop: The while loop executes the multiplication of numbers again and again. The

block i is connected to the body of while loop and then to the numeric display.

RESULTS:

The results of the execution are as follows:

The numeric 2 is displaying the no of times the loop has executed.

TASK-3:

Implement the table of 2 and 5 using fro loop in the labview model.

FRONT PANEL:

The front panel of the model contains:

Numeric Control: It controls the max value of loop counter. The loop executes the number of times the number entered in this block.

Array Values: The array values displays the numbers in the for loop.

BLOCK DIAGRAM:

The block diagram contains the following blocks:

Numeric Constant: The number for which the table is to be displayed is written in this block. Increment: It increments the value of loop counter. Gain: It multiplies the number for which the table is to be generated by the number in the

loop counter. Array: It generates an array of numbers. For Loop: It is used to execute the same command again and again using different values for

each execution.

RESULTS:

Table of 2:

Table of 5:

Task-4:

Using case structure implement temperature conversion formulas.

FRONT PANEL:

The front panel contains:

Enum: Enum provides list of options to be written into it. It is used when no of commands are to be added to the same loop.

Numeric Control: The temperature which is to be converted to other form is written in this block.

Thermometer: It displays the resultant temperature on the scale.

BLOCK DIAGRAM:

The block diagram contains:

Enum: it allows to add different controls to case structure. Case Structure: It is the if else statement of labview. In this block the controls for each

command are added. Numeric Control: The temperature to be converted is added in this block. Formula Block: The formula block contains conversion formula. Thermometer: The result of conversion are shown on thermometer scale.

RESULTS:

The results of conversion are as follows:

LAB # 04

“IMPLEMENTING TABLES IN LABVIEW”

TASK-1:

Make a calculator using case structure in lab view.

FRONT PANEL:

The front panel of the project includes the:

Numeric controls: It is used to input numbers for any kind of operation. Enum : it is used to select operation to be performed on numbers. Numeric indicator : It is used to display results.

BLOCK DIAGRAM:

The block diagram shows the development steps of project. The block diagram window has the:

Numeric Control: to input numbers for the operation. Numeric Indicator : To display the results of operation. Enum: To select the desired operation. Case Structure : To decide the true case in each operation. Case Structure: The case structure decides the true case in each operation. The case

structure contains the gain block for each operation. Then the numeric indicator is connected at the other end to display the results. The enum selects the operation of the user’s choice.

RESULT:

TASK 2:

Implement the tables from 2-5 in labview using case structures and loops.

FRONT PANEL:

The front panel of the project contains:

Numeric Control: It controls the max value of loop counter. The loop executes the number of times the number entered in this block.

Array Values: The array values displays the numbers in the “for loop”.

BLOCK DIAGRAM:

The block diagram contains the following blocks:

Numeric Control: Three numeric controls are there:Numeric control 3 contains the numbers of which table is being displayed.Numeric control 4 contains the case value.Numeric control 5 is displaying the value of loop counts.

Increment: It increments the value of loop counter. Gain: It multiplies the number for which the table is to be generated by the number in the

loop counter. Array: It generates an array of numbers. For Loop: It is used to execute the same command again and again using different values for

each execution. Case Structure: It is used to decide the correct case for the input number.

RESULTS:

The result-s of the simulation are as follows:

Table of 2:

Table of 3:

Table of 4:

Table of 5:

LAB # 05

“AUTOMATIC LIGHTS SWITCHING IN LABVIEW”

LIGHT DETECTING RESISTORS:

The light detecting resistors are called as LDR’s. These are variable resistors whose resistance decreases with increasing light intensity. This phenomenon is called as photoconductivity. They are constructed with high resistance semiconductor material that is why the resistance of LDR’s is very high. The resistance lies in the range of mega-ohms. They are used in light sensing applications.

If incident light on a photoresistor exceeds a certain frequency, photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. The resulting free electrons conduct electricity, thereby lowering resistance. The resistance range and sensitivity of a photoresistor can substantially differ among dissimilar devices. Moreover, unique photo resistors may react substantially differently to photons within certain wavelength bands.

TASK-1:

Implement a project in labview which turns off the lights in the hours of day time and turns them on in the night time.

FRONT PANEL:

The front panel of the project contains:

Led’s: The LED’s in the project are the representation of street lights. They are turned on and off after calculated period of time.

Loop Control: The loop control controls the loop execution manually. The loop can be stopped any time using the loop control button.

The front panel of the project is as follows:

BLOCK DIAGRAM:

The block diagram of the project contains:

LED’s: The LED’s represent street lights which are to be controlled automatically. Local Variables: They provide control for LED’s. They can be used in “write mode” i.e.

commands can be given to them. Or can be used in “read mode” i.e. commands can be taken from them.

Delay: It is a type of clock or timer that causes delay in some task. If a task is to be performed for a specific time, then this tool is used to cause a delay and perform it for required time.

Flat Sequence: This tool of labview performs a task in sequential order. The tasks are performed in a sequence in which they are placed in flat sequence cases.

While Loop: The while loop will keep on performing the task placed inside it as long as required.

Loop Control: it is a manual control for a loop. Loop can be stopped at a desired instant using this tool.

The block diagram of the project is as follows:

PROCEDURE:

The idea of street lights is that they turn on automatically in the night hours and switch off by themselves in the day times. There can be two procedures for controlling the lights.

i. By using LDR’s and dark sensors.ii. Using some timer circuit that turns them on for some calculated hours and turns them

off for the rest of the time.

Implementing the idea of timers in labview requires the following procedure.

Let;

The time from 5am-7pm can be considered to be the day hours. They count totally as 14 hours. So;

The rest of the hours from 7pm-5am can be considered to be the night time which are 10 hours in total. So,

Step-1: Create local variable with each LED. Connect the local variable with the LED. Covert

the local variable to reading mode.

Step-2: Create two blocks of the flat sequence tool and place the local variables inside the

flat sequence and set the local variables to writing mode.

Step-3: Create constants with local variables. In the first block of flat sequence set the local

variable to true case i.e. LEDs will turn on. In the second block of flat sequence, set the local variables to false case i.e LED’s will turn off.

Step-4: Select a delay from timers and place one each in each block of flat sequence. Create

a constant with each timer and write the desired units of time in each constant.

Step-5: Simulate the project.

The simulation results are as follows:

TASK-2:

Using the idea of delays, make a project in labview that controls the lightning system of a house.

FRONT PANEL:

The front panel of the project has the following tools:

LED’s. Loop control.

The loop controls is a manual control for stopping the loop at the desired time. The three LED’s represent the lights of three different areas in a house. They represent the lights of kitchen, TV lounge and outer lights.

BLOCK DIAGRAM:

The block diagram of the project has the following tools;

LED’s: The LED’s represent the lights of a certain house which are to be controlled automatically.

Local Variables: They provide control for LED’s. Delay: this clock timer provides delay for turning the LED’s on and off. Flat Sequence: This tool helps to turn on and turn off the lights in sequential order. While Loop: The while loop will keep on performing the task placed inside it as long as

required. Loop Control: It is a manual control for a loop. Loop can be stopped at a desired instant

using this tool.

The block diagram of the project is as follows:

PROJECT EXPLANATION:

The requirement of the project is that the lights of the kitchen must turn ON by 7pm in the night, the lights of the TV lounge must turn ON by 9pm and the lights of the outer region e.g lawn must turn ON by 12pm in the night and all the lights must turn OFF altogether in the morning by around 7AM. The calculated time for these hours is 5 seconds, 4 seconds and 3 seconds respectively. So each of the section in flat sequence has the desired delay in the timer and the desired local variables are being commanded to turn on or off the respective led’s in the front panel for required time.

SIMULATION RESULTS:

The results of simulation are as follows:

LAB # 06

“TRAFFIC LIGHTS CONTROL IN LABVIEW”

TASK:

Control the traffic signal lights using delays in labview.

PROJECT EXPLANATION:

The requirements of the project are that the traffic signal lights must switch from one to another after a calculated period of time. All the lights must stay ON for a short span of 3-4 minutes. Scaling the time span to sample time;

Let,

So the lights will turn ON for 3 seconds each.

FRONT PANEL :

The front panel of the project contains the following tools;

1. LED’s2. Rectangle shape.

The front panel view of the project is as given below.

BLOCK DIAGRAM:

The block diagram of the project contains the following tools;

1. LED’s.2. Local variables.3. Flat sequence.4. While loop.5. Loop control.6. Timer.

PROCEDURE:

Insert a simple rectangular block in the blank VI file. Then collect three LED’s and place them in the project’s front panel. Open the color pallet from the options and change the colors of the LED’s to turn them red green and yellow to represent the traffic signal lights. Arrange all the LED’s in a proper sequence and place them above the rectangular box. Group all the shapes and tools together so they don’t move apart. Then open the block diagram and create the local variables associated with each LED. Create four copies of each LED and contain three copies in the three sequences of a flat sequence. Place a timer in each sequence of the flat sequence and set the timer to 3000ms. Contain the whole diagram in the while loop. Create a control with the loop control for manual control of loop.

RESULTS:

The results of the simulation are as follows:

LAB # 07“WATER LEVEL CONTROL”

TASK:

Construct a model in labview that controls the water level automatically such that when it reaches the value of about 80% of the total height of the tank, the water valve turns off and when the water level reaches the minimum value of about 10%, the valve opens up.

FRONT PANEL:

The front panel of the project contains the following tools.

1. Water tank.2. Horizontal slider bar.3. Vertical slider bar.4. Numeric display.5. LED’s.6. Loop control.

BLOCK DIAGRAM:

The block diagram of the project contain the following tools.

1. Horizontal slider control.2. Vertical slider control.3. Numeric constant.4. Gain.5. Feedback loop.6. In-range.7. Timer.

8. Loop control.9. While loop.

PROCEDURE:

Collect a tank from the numeric indicators. Collect two LED’s that indicate the full and empty level of the tank. Change the color of the LED indicating full level to green and the one indicating the empty level by red. Collect a horizontal and a vertical slide bars and place the along the tank. Name the horizontal slide bar as inflow and the vertical slide bar as outflow. When the inflow slide bar is full, the tank intakes water and fills up. When the outflow slide bar is full, the tank discharges water and becomes empty.

Open the block diagram of the project and subtract the value in the outflow from the inflow. Then create a feedback loop and connect the results from the subtraction with the feedback loop through a tool named “in range”. Connect two numeric constants with each terminal of the in range and set the range from 0-100. Connect the output to the tank. Connect two gains with each LED in block diagram, one gain compares the less than and equal value and other compares greater than and equal value. Connect the output from each LED to the tank. Simulate the project.

RESULTS:

The results of the simulation are as follows:

LAB # 08“AUTOMATIC GEAR SELECTOR”

SPEEDOMETER:

A speedometer or a speed meter is a gauge that measures and displays the instantaneous speed of a vehicle. Now universally fitted to motor vehicles, they started to be available as options in the 1900s, and as standard equipment from about 1910 onwards. Speedometers for other vehicles have specific names and use other means of sensing speed. For a boat, this is a pit log. For an aircraft, this is an airspeed indicator.

BRAKES:

A brake is a mechanical device which inhibits motion, slowing or stopping a moving object or preventing its motion. The rest of this article is dedicated to various types of vehicular brakes. Most commonly brakes use friction between two surfaces pressed together to convert the kinetic energy of the moving object into heat, though other methods of energy conversion may be employed. For example regenerative braking converts much of the energy to electrical energy, which may be stored for later use. Other methods convert kinetic energy into potential energy in such stored forms as pressurized air or pressurized oil. Eddy current brakes use magnetic fields to convert kinetic energy into electric current in the brake disc, fin, or rail, which is converted into heat. Still other braking methods even transform kinetic energy into different forms, for example by transferring the energy to a rotating flywheel.

ACCELERATOR:

A valve that regulates the flow of a fluid, such as the valve in an internal-combustion engine that controls the amount of vaporized fuel entering the cylinders. A lever or pedal controlling such a valve.

AUTOMATIC GEAR SYSTEM:

An automatic transmission (also called automatic gearbox) is a type of motor vehicle transmission that can automatically change gear ratios as the vehicle moves, freeing the driver from having to shift gears manually. Like other transmission systems on vehicles, it allows an internal combustion engine, best suited to run at a relatively high rotational speed, to provide a range of speed and torque outputs necessary for vehicular travel. Electronically controlled transmissions, which appear on some newer cars, still use hydraulics to actuate the clutches and bands, but each hydraulic circuit is controlled by an electric solenoid. This simplifies the plumbing on the transmission and allows for more advanced control schemes.

TASK:Implement an automatic gear selector for a car that indicates the following for speed change.

1. When speed is zero, neutral gear is on.2. When speed is between 0 and 20, gear 1 is on.3. When speed is between 20 and 40, gear 2 is on.4. When speed is between 40 and 60, gear 3 is on.5. When speed is between 60 and 80, gear 4 is on.6. When speed is above 90 the system gives a message to reduce the speed of vehicle.7. For negative speed, reverse gear is active.

IMPLEMENTATION:Tools:

The implementation of the automatic gear selector requires the following tools:

Horizontal slider. Meter. LED’s. Loop control. And operator. Less than operator.

Greater than operator. Numeric constants. Equal to zero operator.

PROCEDURE:

Make a connection between a horizontal slider and meter. Then take an input form the slider and connect an equal to zero tool to it. From the output of the tool connect the wire to the neutral gear. Then take two wires from the slider and connect them to greater and less than tool and to the other terminals of both the tools, connect numeric constants that define the range of the gears from 1-4. Then and the outputs from both the tools and connect them in the gears’ input. For the reduce speed message, take an input from the slider and connect a greater than tool and then connect the output to the respective LED.

FRONT PANEL:

The front panel of the project is as follows:

BLOCK DIAGRAM:

The block diagram of the project is as follows:

RESULTS:

LAB # 09

“IMAGE PROCESSING”

IMAGE:

An image is an artifact that records visual perception. It is a 2D representation of a worldly thing i.e. objects, human or nature. An image is a visual representation of something.

IMAGE PROCESSING:

The analysis and manipulation of a digital image in order to improve its quality. To perform any process on an image in special domain is referred to as image processing. It includes moving pixels, filtering, black and white image, blur, highlight the image.

PIXELS:

A pixel is a basic picture element. It is a point in a graphic image. Any graphical picture or display is composed of thousands and millions of small blocks called pixels which are arranged in rows and columns. They are place so close together that they appear connected. The physical size of a pixel depends on the resolution of display or image.

MONOCHROME IMAGE:

A mono-chrome image is an image that contains only one color against a neutral background such as a painting or a sketching. Old green screen monitors are an example of monochrome display. All black and white images are monochrome images but not all monochrome images are black and white.

The range of pixels for a monochrome image is form 0-255.

RGB IMAGE:

RGB stands for “Red Green Blue”. It represents three hues of light that can be mixed to produce any other color. The mixing of highest intensity of all three colors produces white light while the dimmest intensity produces black color. An rgb image is a colored image. It contains all the original colors.

TRANSFORMATION:

Transformation in image processing corresponds to performing any operation on an image to convert it from one representation to another. The operation may be a simple arithmetic operation or any complex operation. These operations include rotation, radon transform, fourier transform, hough transform, image interpolation etc.

IMAGE PROCESSING IN LABVIEW:

Labview contains options to process an image. Therefore images can be processed using labview. Image processing in labview is somewhat difficult as compared to image processing in labview. Image processing in labview requires the following tools:

1. File path control.2. Image data.3. Read image.4. New picture.5. Draw flattened.6. Unbundle.7. Reverse 1D array.

FILE PATH CONTROL: This tool provides the path to the image being processed.

IMAGE DATA: This tool reveals the data contained in an image such as pixels, size, depth etc.

READ IMAGE: This tool reads the image for processing.

NEW PICTURE: This tool shows the image being read.

REVERSE 1D ARRAY: This tool reverses the image.

TASK-1:Process an image using LABView.

FRONT PANEL:

The front panel of the project is as follows:

BLOCK DIAGRAM:

The block diagram for image processing can be drawn as follows:

RESULTS:

IMAGE PROCESSING IN MATLAB:

Image processing in MATLAB is preferred because of ease of its use. It has its built in libraries that make it easy to use. The commands are easy and self explaining.

The following commands are used to read and show image using MATLAB;

Imread: This command reads the image. The format of wirting this command is as given below:

Imread(‘image.jpg/tif/png/jpeg’);

Sometimes it is convenient to store the image in some variable for later processing. The command is then written as;

X=Imread(‘image.jpg/tif/png/jpeg’);Where x is some variable.

If the image is not in the workspace of MATLAB, then the image is accessed by providing the full path to the image in the argument of the above command as follows;

x=imread('C:\Users\dell\Pictures\Camera Roll\New folder\flynn.jpg');

Imshow: This command shows the image. The format for writing this command is as follows:

Imshow(‘image.jpg/jpeg/tif/png’);

The following commands are used to increment, decrement or multiply some scalar to the pixels of an image thus changing its properties;

Imadd: This command adds some scalar to the pixels of image being processed, thus increasing the brightness. The format for writing this command is as follows:

Imadd(image.jpg,n);Where n is the number to be added.

Imsubtract: This number subtracts a scalar from the pixels of an image being processed hence darkening the image or in other words decreasing the brightness. The format for writing this command is as follows:

Imsubtract(image.jpg,n);Where n is the number to be subtracted.

Immultiply: This number multiplies some scalar to the pixels of image being processed. This command changes the intensity of colours in the image. The format for writing this command is as follows:

Immultiply(image.jpg,n);

Where n is the number to be multiplied.

TASK-2:

Process an image using MATLAB.

The MATLAB commands for increasing or decreasing the brightness or changing the color intensity can be written as follows. All the effects are plotted in the same figure to observe the effects clearly.

MATLAB CODE:

The matlab code for processing image can be written as follows:

a=imread('cat.jpg');

c=immultiply(a,20);

d=imsubtract(a,100);

e=flipud(a);

figure(1)

subplot(2,2,1)

imshow(a)

subplot(2,2,2)

imshow(c)

subplot(2,2,3)

imshow(d)

subplot(2,2,4)

imshow(e)

RESULTS:

Executing the above commands generates the following results;

ANALYSIS:

Comparing the results of both the software, it can be observed that both the sofwares are capable of performing same operations and producing the same results.

LAB # 10:“AUDIO SIGNAL PROCESSING”

AUDIO SIGNAL PROCESSING:

Audio signal processing, sometimes referred to as audio processing, is the intentional alteration of auditory signals, or sound, often through an audio effect or effects unit. As audio signals may be electronically represented in either digital or analog format, signal processing may occur in either domain. Analog processors operate directly on the electrical signal, while digital processors operate mathematically on the digital representation of that signal.

.WAV SOUND FILES:

.wav stands for waveform audio file format. It is a Microsoft and IBM audio file format standard for storing an audio bit stream on PCs. It is an application of the Resource Interchange File

Format (RIFF) bit stream format method for storing data in "chunks", and thus is also close to the 8SVX and the AIFF format used on Amiga and Macintosh computers, respectively. It is the main format used on Windows systems for raw and typically uncompressed audio. The usual bit stream encoding is the linear pulse-code modulation (LPCM) format.

TASK:

Process a .wav extension sound file using LABVIEW.

TOOLS REQUIRED:

To process a sound signal, in labview, we need following tools:

1. File path control.2. Sound file (read/write).3. Index array.4. Graph.5. Play waveform.6. Get waveform.7. Build waveform.8. Sound file info.9. Reciprocal.10. Numeric indicators.11. Build array.

PROCEDURE:

Connect the file path control to the path terminal of the sound file read tool. Connect path out terminal to the index array’s array terminal then take the output from the element terminal. Connect this output to the data terminal of the play waveform, graph and get waveform components. Connect the Y output from get waveform components to the reverse 1D array and dt output to the dt tool. Also take the reciprocal of the dt tool input. Connect a numeric indicator with the reciprocal. Connect build waveform to the output of reverse 1D array. Connect the play waveform to error in of another paly waveform and connect the data terminal of play waveform 2 to the graph tool. Also input the outputs of build array and build waveforms to the graph tool.

EXPLANATION:

The file path control tool provides the path to the desired sound file. The sound file is then read by the sound file read tool. Then an array is generated containing the elements of the sound file. The sound wave is converted to 1D array data. The original sound wave can be played using the play waveform tool. Also the graph of the waveform can be seen using graph tool. Then the sound

wave is ready to be processed. The desired waveform is then added into a get waveform tool and reversed using the reverse 1D array. The scattered data is then bundled together.

Front panel:

The front panel of the project is as follows:

BLOCK DIAGRAM:

The block diagram of the project is as follows:

RESULTS:

The results of the simulation are as follows:

LAB # 11: “ARITHMATIC OPERATIONS ON SIGNALS”

SIGNAL:

A gesture, action, or sound that is used to convey information or instructions, typically by prearrangement between the parties concerned.

A detectable physical quantity or impulse (as a voltage, current, or magnetic field strength) by which messages or information can be transmitted."

"A signal is a function of independent variables that carry some information."

"A signal is a source of information generally a physical quantity which varies with respect to time, space, temperature like any independent variable"

"A signal is a physical quantity that varies with time, space or any other independent variable.by which information can be conveyed."

RMS VALUE:

In mathematics, the root mean square (abbreviated RMS or rms), also known as the quadratic mean, is a statistical measure of the magnitude of a varying quantity. It is especially useful when variants are positive and negative, e.g., sinusoids. In the field of electrical engineering, the RMS value of a periodic current or voltage is equal to the DC current or voltage that delivers the same average power to a resistor as the periodic current. The RMS value of a set of values (or a continuous-time waveform) is the square root of the arithmetic mean of the squares of the original values (or the square of the function that defines the continuous waveform).

PEAK-PEAK VALUE:

Peak-to-peak (pk-pk) is the difference between the maximum positive and the maximum negative amplitudes of a waveform. If there is no direct current (DC ) component in an alternating current (AC ) wave, then the pk-pk amplitude is twice the peak amplitude. For an AC sine wave with no DC component, the peak-to-peak amplitude is equal to approximately 2.828 times the root-mean-square amplitude. Peak-to-peak values can be expressed for voltage, current , or power

TASK:Generate different signals apply arithmetic operations on them, find their parameters or attributes and indicate it on graph.

TOOLS REQUIRED:

Simulate signal. Waveform graph. Amplitude and level measurement. Multiply. Add. Subtract.

TOOLS’ DESCRIPTION:

1. Simulate signal: This tool generates various signals such as sine, cosine, square wave, DC signal, triangular wave and saw tooth wave. The frequency and amplitude of these waves can also be controlled by this block. The phase and offset value can also be controlled.

2. Waveform graph: This tool displays the graph of the waveforms that are fed into it.3. Amplitude and level measurement: This tool calculates different attributes related to the

waveforms. These attributes include RMS value, average value, mean or DC value, positive peak value, negative peak value, peak-peak value, maximum value, minimum value.

4. Multiply: This tool multiplies the two input waveforms.5. Subtract: This tool subtracts the input waveforms.6. Add: This tool adds the two input waveforms.

PROCEDURE:

Collect two simulate signal blocks from the express option and connect them to the waveform graph. Then take a multiply/add/subtract tool from arithmetic option and input the both waveforms into it. Display the output on the graph and also connect it to the amplitude and level measurements tool. Go into the parameters of amplitude and measurements block and check all the attributes of a wave and then connect graphs to each of the outputs.

FRONT PANEL:

The front panel of the project is as follows:

BLOCK DIAGRAM:

The block diagram of the project is as follows:

RESULTS:

The results for different mathematical operations on signals yielded the following results.

Multiply:

Multiplication of triangular and saw tooth wave yields the following results. The frequency of the triangular wave is 10hz whereas the frequency of the saw tooth wave is 20 hz.

Multiplication of a triangular and square wave yields the following results. The frequency of the triangular wave is 10hz whereas the frequency of the square wave is 20 hz.

Add:

The addition of a sinusoidal wave and square wave yields the following results. The frequency of the sine wave is 10hz whereas the frequency of the square wave is 20 hz.

The addition of a sinusoidal wave and triangular wave yields the following results. The frequency of the sine wave is 10hz whereas the frequency of the triangular wave is 20 hz.

Subtract:

The subtraction of square wave and saw tooth wave yields the following results. The frequency of the square wave is 10hz whereas the frequency of the saw tooth wave is 20 hz.

The subtraction of the DC signal and the saw tooth wave gives the following results. The frequency of saw tooth wave is 20hz.

LAB # 12“NOISE AND FILTERING”

NOISE:

Noise means any unwanted sound. Noise is not necessarily random. In electronics, noise is a random fluctuation in an electrical signal, a characteristic of all electronic circuits. Noise generated by electronic devices varies greatly, as it can be produced by several different effects. In communication systems, noise is an error or undesired random disturbance of a useful information signal in a communication channel. The noise is a summation of unwanted or disturbing energy from natural and sometimes man-made sources.

TYPES OF NOISE:

There are various types of noise. Some of the types are as follows:

GUASSIAN NOISE:

Gaussian noise is statistical noise having a probability density function (PDF) equal to that of the normal distribution, which is also known as the Gaussian distribution. In other words, the values that the noise can take on are Gaussian-distributed. The probability density function of a Gaussian random variable is given by:

where represents the grey level, the mean value and the standard deviation.

In telecommunications and computer networking, communication channels can be affected by wideband Gaussian noise coming from many natural sources, such as the thermal vibrations of atoms in conductors (referred to as thermal noise or Johnson-Nyquist noise), shot noise, black body radiation from the earth and other warm objects, and from celestial sources such as the Sun.

GUASSIAN WHITE NOISE:

A special case is white Gaussian noise, in which the values at any pair of times are identically distributed and statistically independent (and hence uncorrelated). In communication channel testing and modelling, Gaussian noise is used as additive white noise to generate additive white Gaussian noise.

UNIFORM NOISE:

"Uniform noise" generates a noise sequence having a uniform distribution function with values ranging from a to b. Its parameters are:

Length N (in samples) Minimum value a Maximum value b

The probability of an event occurring in the range from a to b is;

1b−a

POISSON NOISE:

Poisson noise is also called shot noise. Poisson noise is a type of electronic noise which originates from the discrete nature of electric charge. The term also applies to photon counting in optical devices, where shot noise is associated with the particle nature of light.

GAMMA NOISE:

The gamma distribution is a two-parameter family of continuous probability distributions. The common exponential distribution and chi-squared distribution are special cases of the gamma distribution. There are three different parameterizations in common use:

1. With a shape parameter k and a scale parameter θ.2. With a shape parameter α = k and an inverse scale parameter β = 1/θ, called a rate

parameter.3. With a shape parameter k and a mean parameter μ = k/β.

In each of these three forms, both parameters are positive real numbers

PERIODIC RANDOM NOISE:

Periodic Random Noise (PRN) is a summation of sinusoidal signals with the same amplitudes but with random phases. PRN consists of all sine waves with frequencies that can be represented with an integral number of cycles in the requested number of samples. Since PRN contains only integral-cycle sinusoids, you do not need to window PRN before you perform spectral analysis because PRN is self-windowing and, therefore, has no spectral leakage.

INVERSE F NOISE:

Inverse f noise, also known as flicker noise or 1/f noise, is defined as a signal whose power spectrum is proportional to the reciprocal of the frequency. Inverse f noise occurs in many real-world scenarios such as electronics, biological and chemical systems, and oceanography.

BINOMIAL NOISE:

Binomial noise is defined by a binomial distribution. The binomial distribution is a discrete probability distribution of the number of successes in a sequence of n independent yes or no experiments; each of the independent experiments has a probability equal to p. Binomial distribution, like the Poisson distribution, is discrete.

FILTER:

In signal processing, especially electronics, an algorithm or device for removing parts of a signal. An electronic filter is an electronic circuit which processes signals, for example to remove unwanted frequency components.

TYPES OF FILTERS:

There are various types of filters. The common type of filters are as follows:

HIGH PASS FILTERS:

A high-pass filter is an electronic filter that passes signals with a frequency higher than a certain cutoff frequency and attenuates signals with frequencies lower than the cutoff frequency. The amount of attenuation for each frequency depends on the filter design.

LOW PASS FILTERS:

A low-pass filter is a filter that passes signals with a frequency lower than a certain cutoff frequency and attenuates signals with frequencies higher than the cutoff frequency. The amount of attenuation for each frequency depends on the filter design. The filter is sometimes called a high-cut filter, or treble cut filter in audio applications. A low-pass filter is the opposite of a high-pass filter.

BAND PASS FILTERS:

A band-pass filter is a device that passes frequencies within a certain range and rejects (attenuates) frequencies outside that range.

BAND STOP FILTERS:

Also called band-elimination, band-reject, or notch filters. In signal processing, a band-stop filter or band-rejection filter is a filter that passes most frequencies unaltered, but attenuates those in a specific range to very low levels. It is the opposite of a band-pass filter. A notch filter is a band-stop filter with a narrow stop band (high Q factor).

Task:

Take a signal, add noise to it

TOOLS:

The following tools are required to filter noise from a signal.

Simulate signal. Graph. Filter.

TOOLS DESCRIPTION:

Simulate signal: This tool can generate different signals and also contains the option to produce noise in the signals.

Graph: This tool shows the graphical representation of waveforms, noises and filtered signals.

Filter: like real time filters, the filter tool in LABview is meant to remove unwanted signals from the original signal.

FRONT PANEL:

The front panel view of the project is as follows:

BLOCK DIAGRAM:

The block diagram of the project can be developed as follows:

RESULTS:

The results of the simulation are as follows:

Periodic random noise:

Gamma noise:

Poisson noise:

Binomial noise:

Bernoulli noise:

MLS sequence:

Inverse F noise:

ANALYSIS:

In all of the above results, it can be observed that low pass filter, band stop filter and smoothing filters are producing good results of filtering. The original shape of the signal is not being regained but much of the noise is being reduced by these filters. All other filters are unable to remove or filter much noise from the signal. The most appropriate results from the fore mentioned filters is being produced by the low pass filter. The reason is that the noise is a high frequency signal which is being added to a normal or low frequency signal. So only low pass has the ability to reject the high frequencies and pass all the low frequencies efficiently. So the resulting waveform is somewhat closer to the original one.

top related