Optimization and genetic algorithms

2 views (last 30 days)
KHURRAM
KHURRAM on 2 Feb 2011
How can I learn more about writing M-files to do optimization and genetic algorithms in MATLAB?

Accepted Answer

Jan
Jan on 2 Feb 2011
Most of all read the help of the corresponding commands and the chapters in the documentation. "Optimization" is a very broad field, e.g. you can estimate parameters, search an optiomal control of a dynamic system, find an optimal set of integers, etc. If you define more details, a more specific answer would be possible.
  1 Comment
KHURRAM
KHURRAM on 4 Feb 2011
many thnx, could u please help me to write a code for imedance matching pi network to find the values of c1 c2 and L for GSM and UMTS frequency range.

Sign in to comment.

More Answers (1)

George Evers
George Evers on 3 Feb 2011
Khurram,
In addition to the usual documentation, The MathWorks provides "Getting Started Guides" on many topics. If you plan to use the GADS toolbox, I recommend reading its guide [1] before delving into the code since learning MATLAB or even a new toolbox is analogous to learning a new foreign language in the sense that establishing a foundation and then immersing yourself in its natural context works quite well.
Stepping through relevant M-files would help both with learning optimization functions and with learning how the files are written. The effects of each line of an M-file can be observed by:
  1. Pressing Ctrl + H to replace all semicolons with blank spaces so that the corresponding calculations will be shown in the Command Window,
  2. Saving the modified file to a new name,
  3. Left-clicking the hyphen to the right of the line number for the first line of code, which produces a red circle representing a breakpoint,
  4. Pressing F5 to begin execution,
  5. Pressing F10 to step through each line of code,
  6. Observing the outputs in the command window beside the Editor
MATLAB's offline help menu is quite useful for understanding precisely how functions work. Leaving it open avoids the load time and renders it much more efficient than Visual Studio's haphazard cloud approach, which often produces outdated, irrelevant "help". So let's say you delve into an M-file and highlight a few functions with which you're unfamiliar. Typing "help Func_Name" at the command prompt produces a concise explanation of how to use function Func_Name; and "doc Func_Name" opens the full help file.
When you begin writing your own M-files, the necessary commands can usually be found by searching the help index for the obvious keyword(s), and related commands are generally linked to at the end of each file.
You might not need to start from scratch if you can locate a relevant upload at the File Exchange, where a search for "optimization" shows about 600 user contributions [2], and the more specific "optimization toolbox" shows about 100 uploads. After comparing features, documentations, and support availability, you might find it easier and more productive to contribute to an existing project than to start from scratch.
  1. http://www.mathworks.com/help/toolbox/gads/bp9xm64.html
  2. http://www.mathworks.com/matlabcentral/fileexchange/?term=optimization
Regards,
George Evers
http://www.georgeevers.org

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!