TECHNICAL UPDATES
 
Products Updates
 

Embedded MATLAB Subset Translates into Efficient Embedded Code
Embedded MATLAB™ is a new programming paradigm in MATLAB that connects algorithm development with embeddable implementation. It is the subset of the MATLAB language suitable for implementation in an embedded environment and this subset is capable of automatic C and HDL code generation.

 
Working with products that support the Embedded MATLAB™ subset, you can generate C and HDL automatically from MATLAB, and include MATLAB algorithms in Simulink models for efficient system simulation and code generation.

It saves you the need for re-implementation at lower-level languages, because it provides you with ability to generate efficient code automatically from the well-defined MATLAB language subset

Recommended Embedded MATLAB™ workflow:

To learn more about the Embedded MATLAB subset through product demos that highlight features or application examples, please visit the link below:
http://www.mathworks.com/products/featured/embeddedmatlab/demos.html

To find out more about the functions and/or products that are supported for Embedded MATLAB™, please email to support@techsource.com.my

 
 
Tips and Techniques
 

Using Simulink to Simplify the Process of Building a Feedback Loop

In Control System Design, a feedback loop is often used in designing a feedback controller. Let's take an oven as an example, the temperature inside an oven is continuously monitored and feedback to the controller such that the oven temperature is maintained close to the desired temperature. To model this feedback controller, either MATLAB or Simulink will be sufficient to design and construct this system. However, when dealing with complex feedback controller which involves multiple inputs and multiple outputs, it is easier to be accomplished using Simulink.

Let's first consider a simple feedback loop as shown below, by using MATLAB you can compute the closed-loop transfer function H from r to y either using:

1. the formula, or
2. the 'feedback' command

1. Using the formula:
To compute the closed-loop transfer function H for the above system, the following formula is used.

Type:

>>G = tf([1 2],[1 .5 3]);
>>K = 2;
>>H = G/(1+G*K)

The following transfer function will be obtained.

Transfer function:

s^3 + 2.5 s^2 + 4 s + 6
-----------------------------------
s^4 + 3 s^3 + 11.25 s^2 + 11 s + 21

2. Using the 'feedback' command:

To compute the closed-loop transfer function H using 'feedback' command. Type

>>G = tf([1 2],[1 .5 3]);
>>K = 2;
>>H2 = feedback(G,K)

The following transfer function will be obtained.

s + 2
---------------
s^2 + 2.5 s + 7

A major issue with using the formula is that it increases the order of the closed-loop transfer function. In the example above, H is double the order of H2. This is because the expression G/(1+G*K) is evaluated as a ratio of the two transfer functions G and 1+G*K. If

then G/(1+G*K) is evaluated as:

Therefore, the poles of G are added to both the numerator and denominator of H. These excess poles and zeros will negatively impact the accuracy of your results when dealing with high-order transfer functions

If the feedback loop is complex, i.e. involves multi-input multi-output system, it is difficult to build the feedback loop using the methods mentioned above. For example, consider a state-space plant model 'a' with five inputs and four outputs and a state-space feedback controller 'b' with three inputs and two outputs. It is required to connect outputs 1, 3, and 4 of the plant to the controller inputs, and the controller outputs to inputs 4, 5 and 2, 3 of the plant.

To model and construct this feedback loop, it is recommended to use the command 'connect' in MATLAB.Click here to download the MATLAB script used to model this feedback loop.

However, it is much easier to build the feedback loop using Simulink as it provides you with the intuitive 'drag-and-drop' graphical user interface (GUI) for building the feedback loop using block diagrams, allowing you to draw the feedback loop just as you would do with pencil and paper. Thus you can visualize the whole system clearly. Besides, when you want to make any modification to the system, for example changing the number of inputs and outputs of the multi-input multi-output system, adding in more transfer function blocks, etc, it is easier and faster to be done in Simulink compared to MATLAB. This is because you will need to make more changes to the MATLAB algorithm compared to the Simulink model you have built. Click here to download the Simulink model used for this feedback controller.

The Simulink model is as shown below. You can perform simulation and compare it against the transfer function computed using the connect command in MATLAB. The result is exactly the same showing you that both methods are applicable, the difference is on the ease of building the feedback loop only.

 

Algorithm Development Made Easy with latest MATLAB 7.5 (R2007b)

Do you know that the MATLAB Editor is now enhanced with exciting and useful features to facilitate the algorithm development process? We are sharing a few here with you:

Enhancement to Help in Command Window and Editor
To get help for a function in the Command Window or the Editor, you can now highlight the function name and press F1. The reference page for that function appears in a small, temporary (pop-up) window. To close the window, press Escape.

Run Function M-Files in the Editor Using Configurations
In the Editor, you can provide values for a function's input arguments using a configuration, and then run that configuration to use the assigned values. Use a configuration as an alternative to running the function in the Command Window. You can associate multiple configurations with an M-file, each for different input values.

To create a configuration, first open an M-file in the Editor. Then, from the down arrow on the Run button in the toolbar, select Edit Configurations for filename. In the resulting Edit M-File Configurations dialog box, add statements and name the configuration.

Code Folding Feature for Collapsing and Expanding Code
To improve the readability of files containing several subfunctions, the Editor now includes a code folding feature, which is enabled by default. Using this feature you can collapse and expand subfunctions and their associated help. The following figure shows the collatzplot_new function collapsed, such that only the function definition is displayed. The figure shows the collatz function expanded, revealing both the help code and the function code. If you collapse just the help code, only the H1 help line displays.

  • To expand code that is collapsed, click the plus sign (+) to the left of the code you want to expand.
  • To collapse code that is expanded, click the minus sign (-) to the left of the code you want to collapse.
  • To expand or collapse all of the code in an M-file, place your cursor anywhere within the M-file, right-click, and then select Code Folding > Expand All or Code Folding > Collapse All from the context menu.

For more information on other latest features or enhancement to MATLAB 7.5, kindly acess http://www.mathworks.com/products/matlab/whatsnew.html for further details.

 
 
EVENTS & TRAINING
 

Learn and do more with MATLAB & Simulink

'Applying Neural Applications in Image Processing' training

Workshop Highlights:
This 2-day hands-on workshop aims to provide existing MATLAB users a broad introduction to the basic concepts of artificial neural networks and its applications in image processing. The training will examine several neural network architectures and their training algorithms.  Examples of neural networks architectures that are covered in this course are single layer perceptrons, multilayer perceptrons, radial basis function and Hopfield neural networks. Applications that will be covered are object recognition, character recognition, handwritten word and digit recognition. 
Upon completion, you will be able to:

  • understand the fundamental concepts of artificial neural networks techniques
  • distinguish between the classical pattern recognition algorithms and the neural network techniques
  • compare the relative merits of various neural networks, i.e single layer Perceptrons, multilayer Perceptrons, and radial basis function
  • explain supervised and unsupervised training algorithms
  • describe the typical applications of neural networks to signal and image processing problems

In-house or customized training is also available on request, please contact Activemedia at 6742-8173 for details. Other relevant training courses provided by Activemedia include:

- Comprehensive MATLAB
- Advanced MATLAB Programming Techniques
- Building GUIs with MATLAB
- Applying Image Processing Techniques with MATLAB and SIMULINK
- Applying Neural Network with MATLAB

 
 
Visit www.activemedia.com.sg or Contact us at:
Singapore:
(65) 6742 8173
enquiry@activemedia.com.sg
Malaysia:
(60) 3 7880 8522
enquiry@activemedia.com.my
Thailand:
(66) 2 612 9390-1
info@activemedia.in.th

 
 
Customer Applications
 

Purdue University Standardizes on MATLAB to Provide First-Year Students with Core Engineering Skills

To teach first-year students to learn how to solve fundamental engineering problems
Use MATLAB to enable all first-year engineering students to acquire essential problem solving skills
• Students focus on problem solving, not coding
• Students obtain skills required for upper-level courses
• Professors create a multitude of engineering problems
 


First-year engineering students must develop a logical problem solving process for fundamental engineering problems, such as graphical representation, statistics, and economics. For faculty, this means designing courses and assignments that will engage and challenge students to develop the skills needed for upper-level courses-without requiring a great deal of programming.


Students learning MATLAB in a computer lab.

Purdue University teaches essential introductory engineering skills to more than 1,600 first-year students annually using MATLAB as part of an innovative program. By combining introduction to engineering fundamentals with computer tools, the program encourages students to work effectively in technical teams while learning to translate engineering problems into mathematical models.
"Students learn to implement solution algorithms using MATLAB," says Heidi Diefes-Dux, assistant professor in the Department of Education Engineering at Purdue University. "This provides them with skills they need to confidently pursue their engineering path."

 

Challenge

Purdue University needed a software package that would enable first-year students to be productive immediately in ENGR 106: Engineering Problem Solving and Computer Tools.

"Learning C or FORTRAN requires additional ramp-up time and extra programming steps," says Diefes-Dux. "For instance, students may need to learn looping structures before they can plot. This makes it more difficult to get our students up and running."

Finally, they needed to introduce students to the software tools required for upper-level courses.
"The engineering faculty needs first-year students to become skilled in the core software packages early, so they can spend more time learning advanced concepts in the upper-level courses and less time getting their computer skills up to speed," explains Diefes-Dux.

"The MATLAB programming language and visualization capabilities engage our students and help them see results instantly. The toolboxes help them solve problems more easily than with C or FORTRAN."

Heidi Diefes-Dux,
Purdue University

 

Solution

Purdue University chose MATLAB as the programming environment for ENGR 106. By the end of their freshman year, students are well prepared for upper-level courses-regardless of their discipline.

"The students learn so much in class using MATLAB," says Diefes-Dux. "They don't realize until months later that they came in without any programming knowledge and can now create substantial pieces of code and perform specialized operations, such as image processing."

In the lecture component of the course, Diefes-Dux introduces the problem solving method, fundamentals of engineering, and programming concepts. Diefes-Dux then instructs her students to build a glossary of MATLAB syntax as they learn new operations. In the lab, student teams practice using MATLAB syntax while solving simple engineering problems. Through homework and projects, students use MATLAB to solve more open-ended, authentic engineering problems.

In one lab exercise, student teams use MATLAB and the Image Processing Toolbox to quantify the size of aluminum crystals from micrographs by processing the image arrays.

"With the Image Processing Toolbox, students only need to write one line of code to get the image to appear on the screen," says Diefes-Dux.

In a similar lab exercise, students use MATLAB and the Image Processing Toolbox to determine the nano roughness of a fabricated gold surface. Using images from atomic-force microscopes, they lay random lines on top of the images and use these lines to identify and measure the heights of peaks and valleys.

"The array capabilities of MATLAB help us create more interesting problems for our students," explains Diefes-Dux. "It would have been impossible for them to learn enough C or FORTRAN coding for these image processing problems. MATLAB makes it easy."

Diefes-Dux also uses an open-ended problem to motivate students to use statistics to analyze airline departure times and rank the airlines based on how successfully they connect passengers to their flights. Students use MATLAB to determine the mean and standard deviation of a stored data set, which they treat as an array. They then watch histograms to see the distribution of passenger departure times.

Students also use the Symbolic Math Toolbox to define symbolic variables and write and manipulate equations.

Purdue University has adopted MathWorks tools across all its engineering disciplines, including computer and electrical, mechanical, aerospace, and chemical.

 

Results

  • Students focus on problem solving, not coding. "Using MATLAB rather than C or FORTRAN, students can reduce their coding by at least 2/3, which gives them more time to focus on solving problems," explains Diefes-Dux. "The visualization capabilities of MATLAB also enable our students to see the results of their work instantly."
     
  • Students obtain skills required for upper-level courses. Because MATLAB is taught to every first-year engineering student, upper-level faculty doesn't need to spend precious time getting students up to speed on how to open the program and use the fundamental syntax.
     
  • Professors create a multitude of engineering problems. "With MATLAB, we have a lot of flexibility to use authentic engineering problems," says Diefes-Dux. "When you are coming up with problems, you don't want to be locked into the limitations of the software. With MATLAB, we minimize those issues."

Products Used

Image Processing Toolbox
MATLAB®
Symbolic Math Toolbox