MATLAB IN FOOD INDUSTRY
MATLAB - matrix library
•high performance language for technical computing
• MATLAB allows-
* Matrix manipulation
*Plotting of functions & data
*Implementation of algorithms
*Creation of user interface
• it is a software package for computation &
Visualization
• you can plot 2D & 3D graphics
•you can write your functions
• Basic building block of MATLAB is 'matrix'
• MATLAB was originally written to Provide
Easy access to matrix software developed by the LINPACK & EISPACK projects which together represent the state of the art & software for matrix compulation
• MATLAB features a family of application
Specific to solution called toolbox.
Toolbox : comprehensive collection of MATLAB function (M- file ) that extend the MATLAB environment to solve particular class of problems
Main 5 parts of MATLAB system are -
1. MATLAB language -
* High level matrix/array language with control flow measurement , input output
Function & object oriented programming features
*It allows both •programming in the large
•programming in the small
2. Working environment -
* Involes the set of tools & facilities that
You work in the MATLAB programmer
*It includes tools for developing ,managing
Debugging, profiling m-files , MATLAB applications
*It includes facilities for the management
Of variables in your workplace & import & export of data
3. API-
library that allows you to write C &
Fotone programs that can interact with MATLAB, includes facilities for calling
Routines from MATLAB ( dynamics linking)
Calling MATLAB as computational
4.handle graphics- MATLAB graphic system
Includes high level commands & law level commands
•high level commands: for 3D & 2D data acquisition, image processing, animation & presentation graphics
•law level commands: it allows you to customise the operation as well as build output GUI or your MATLAB applications
5. Library: vast collection of computational
Algorithms ranging from elementary functions like SUM,SIGN,etc.
Application in food industry
1. Some functions of MATLAB like simulink
Do well in stimulating production control,
Quality assessment, forecasting & other aspects while dealing with non-linear & non-stable processing
2. MATLAB was introduced & it application in grading, production control.
Script Files and the Editor/Debugger
You can perform operations in MATLAB in two ways:
1. In the interactive mode, in which all commands are entered directly in the Command window.
2. By running a MATLAB program stored in script le. This type of lecontains MATLAB commands, so running it is equivalent to typing all the commands, one at a time, at the Command window prompt. You can run the le by typing its name at the Command window prompt.
MATLAB uses two types of M- les: script les and function les. You can use the Editor/Debugger built into MATLAB to create M- les. Because they contain commands, script les are sometimes called command les.
Creating and Using a Script File
The symbol % designates a comment, which is not executed by MATLAB. Com-ments are used mainly in script les for the purpose of documenting the le. The comment symbol may be put anywhere in the line. MATLAB ignores everything to the right of the % symbol. For example, consider the following session.
>>% This is a comment.
>>x = 2+3 % So is this.
x =
5
Note that the portion of the line before the % sign is executed to compute x.
Effective Use of Script Files
Create script les to avoid the need to retype lengthy and commonly used proce-dures. Here are some other things to keep in mind when using script les:
1. The name of a script le must follow the MA TLAB convention for naming variables.
2. Recall that typing a variable’s name at the Command window prompt causes MATLAB to display the value of that variable. Thus, do not give a script le the same name as a variable it computes because MATLAB will not be able to execute that script le more than once, unless you clear the variable.
3 .Do not give a script le the same name as a MA TLAB command or function.You can check to see if a command, function, or le name already exists by using the exist command. For example, to see if a variable example1 already exists, type exist(‘example1’); this will return a 0 if the variable does not exist and a 1 if it does. To see if an M- le example 1.m already exists, type exist(‘example 1.m’,’ le’) before creating the le; this will return a 0 if the le does not exist and a 2 if it does. Finally ,to see if a built-in function example1 already exists, type exist(‘example1’, ‘builtin’) before creating the le; this will return a 0 if the built-in function does not exist and a 5 if it does.
Note that not all functions supplied with MATLAB are built-in functions.
For example, the function mean.m is supplied but is not a built-in function. Thecommand exist(‘mean.m’, ‘ le’) will return a 2, but the command exist(‘mean’, ‘builtin’) will return a 0. You may think of built-in functions as primitives that form the basis for other MATLAB functions. You can-not view the entire le of a built-in function in a text editor , only the comments.
Debugging Script Files
Debugging a program is the process of nding and removing the “bugs,” or errors,in a program. Such errors usually fall into one of the following categories.
1. Syntax errors such as omitting a parenthesis or comma, or spelling a com-mand name incorrectly. MATLAB usually detects the more obvious errors and displays a message describing the error and its location.
2. Errors due to an incorrect mathematical procedure, called runtime errors.They do not necessarily occur every time the program is executed; their occurrence often depends on the particular input data. A common example is division by zero.
Cell Arrays
xy Plotting Functions
The “anatomy” and nomenclature of a typical xy plot is shown in Figure ,In which the plot of a data set and a curve generated from an equation appear. A plot can be made from measured data or from an equation. When data are plot-ted, each data point is plotted with a data symbol, or point marker, such as the small circles shown in Figure 5.1–1. An exception to this rule would be when there are so many data points that the symbols would be too densely packed.
After the plot command is executed, the plot will appear in the Figure window. You can obtain a hard copy of the plot in one of several ways:
1. Use the menu system. Select Print on the File menu in the Figure window.Answer OK when you are prompted to continue the printing process.
2. Type print at the command line. This command sends the current plotd directlyto the printer.
3. Save the plot to a le to be printed later or imported into another applica-tion such as a word processor. You need to know something about graphics le formats to use this le properly
Toolboxes use in MATALAB
Curve fitting toolbox-
•allows you to develop custom linear & non-linear models in graphics user interface
•calculs fits & residuals confidence first derivative & integral of the fit
Neural network toolbox
•GUI for creating , training, & simulating
Neural networks
•it has support for the most commonly used supervised
Optimization toolbox
•includes standard algorithms for optimization
•including minimax ,goal attainment & semi infinite minimization problems
Statistics toolbox
•contains about 250 functions & GUI for:
Generating random members , probability
Distribution, hypothesis testing , statistical
Plots & covers basic statistical functionality
Signal processing toolbox
•an environment for signal analysis waveform generation , statistical signal processing & spectral analysis
•useful for designing features in conjunction with the image processing toolbox
0 Comments
Send feedback