Matlab is a scripting programming language that is widely used in various research fields due to its ease of use and comprehensive library of functions.
Today, I will discuss the books and processes that can help a beginner become proficient in Matlab.
Before diving into the specifics, I hope everyone understands that Matlab knowledge is a comprehensive programming tool, similar to a screwdriver set that can be used to fix computers, televisions, home appliances, etc. However, learning to use the tool does not equate to learning how to fix computers, televisions, or home appliances. Deep understanding of algorithmic concepts and operational processes is key to proficiently using Matlab for research. If you cannot achieve this, it indicates that you are not a beginner in Matlab but rather a novice in algorithms and your research content.
Now let’s get started.
1. Learning Matlab Syntax
The first step in learning Matlab is to study the syntax of M language, which is similar to C language. Specific learning can refer to the following content.
(The above textbook was randomly found on Taobao for under 40 yuan. Textbooks are really too expensive now; I can’t afford them)
Select based on your understanding of Matlab.
-
If you have never touched Matlab software, you can start learning from textbooks, but also try to choose a Matlab version that matches the textbook (different versions have huge interface differences). Through the first few chapters of the textbook, you can basically understand the interface, operation process, features, and basic M language syntax of Matlab.
-
If you have heard of Matlab and know a rough idea, you can learn through various online textbooks (if I have the energy, I will also consider creating a set myself, if someone is interested in me).
Just read through the books and materials; there’s no need to memorize them. If you encounter problems, review them.
Through the above learning, you can start using Matlab as a calculator. Next, don’t rush to learn other things; first, try using this calculator to solve the following problems.
-
Calculate the product from 1 to 100 (Answer: 9.332621544394410×10^157)
-
Calculate how many prime numbers there are between 1 and 100000, judging only based on the definition that a prime number can only be divided by 1 and itself (Answer: 9592 prime numbers)
The above problems mainly assess whether you have learned the loop structure, conditional structure, and whether you understand the existence of variables.
After completing the above problems, you will find that Matlab is very useful as a calculator, as it can retain every step of your calculations. Moreover, Matlab’s computational capabilities and methods can accomplish many tasks that calculators previously could not, so have fun with the operations you used to perform on calculators.
2. Learning Common Matlab Functions
The reason everyone praises Matlab is that it provides a large number of computational functions and functions for specialized fields, which can save a lot of effort during development.
I recommend that everyone first learn the computational functions, as these are the main ways to perform calculations in Matlab. They mainly include the following categories:
-
Statistical functions, such as sum, min, max, mean, etc.
-
Matrix operation functions, such as det, inv, eig, svd, matrix usage of sum, matrix usage of mean, etc.
-
Plotting functions, such as plot, stairs, mesh, etc.
-
Output functions, such as fprintf, disp, fopen, fwrite, etc.
-
Random functions, such as rand, randn, etc.
-
Custom functions; learn to write a simple function yourself.
If you have no idea how to study, you can refer to the following content.
(The above textbook was randomly found on Taobao; manuals are expensive and not very useful, so don’t buy them unless you’re wealthy)
After you feel you have learned, try typing out the examples inside (don’t copy, type it yourself) and see if there are any errors (if there are errors, it’s probably because you mistyped). Check if the results are the same.
Through the above learning, you can start using Matlab as an advanced calculator. Next, still don’t rush to learn other things; use this calculator to try the following problems.
-
Use random generation functions to generate a large number of numbers and plot them into a curve.
-
Use Matlab to check your previous linear algebra assignments to see if they match (no need to manually calculate matrix inverses anymore).
-
Other applications you can think of.
After completing the above steps, congratulations, you have basically learned how to use Matlab.
If you still feel lost, it indicates that you have not deeply understood the inner logic of what you want to implement, and you need to change your approach.
3. Learning Matlab Function Libraries in Specialized Fields
As previously mentioned, the reason everyone praises Matlab is that it provides a large number of computational functions and functions for specialized fields, which can save a lot of effort during development. Therefore, when conducting specific development, everyone will certainly prefer to use existing resources instead of deriving everything from scratch; otherwise, why use Matlab when you can just find any scripting language?
Your learning here can be based on your professional field to choose the corresponding Matlab textbooks, for example:
(These books are very expensive, and most of their examples are also quite limited, but they have some reference value. If you can borrow them from the library, it’s worth a look).
If your English and professional knowledge are decent, I still recommend reading Matlab’s help files as much as possible, as they provide detailed introductions.
4. What to Do When Your Program Reports an Error
Most people, after following the previous steps, discover that their program reports errors when they write their own code. This situation is often due to an insufficient knowledge base during the first step of learning (in reality, it’s hard to solidify knowledge just by reading). The suggestions here are:
-
Copy the error message and search it on Baidu; many experts provide answers.
-
Read the error message and modify your code according to the hints.
-
Learn from others’ correct programs and compare the differences.
-
If you really can’t resolve it, try a different approach or actively seek help from experts.
The more pitfalls you encounter, the smoother the path will become.(Why are there so many pitfalls? Because self-learning is mostly like this)
To summarize, learning Matlab is generally quite simple; the challenging part lies in the implementation details and ideas behind various algorithms. Learning to use Matlab is just the first step.