Optimization and genetic algorithms
조회 수: 1 (최근 30일)
이전 댓글 표시
How can I learn more about writing M-files to do optimization and genetic algorithms in MATLAB?
댓글 수: 0
채택된 답변
Jan
2011년 2월 2일
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개)
George Evers
2011년 2월 3일
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:
- Pressing Ctrl + H to replace all semicolons with blank spaces so that the corresponding calculations will be shown in the Command Window,
- Saving the modified file to a new name,
- 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,
- Pressing F5 to begin execution,
- Pressing F10 to step through each line of code,
- 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.
- http://www.mathworks.com/help/toolbox/gads/bp9xm64.html
- http://www.mathworks.com/matlabcentral/fileexchange/?term=optimization
Regards,
George Evers
http://www.georgeevers.org
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!