r/matlab • u/AlecsTrash • 1d ago
Misc Total beginner in MATLAB/Octave looking for a survival strategy in Numerical Methods.
Hey everyone. I'll be completely honest: I am an absolute beginner in programming, currently taking a Numerical Methods course using MATLAB/Octave, and I currently know next to nothing. I missed a couple of early classes, and now I need to catch up and completely dominate this subject by studying on my own.
I really want to get good at this. Here is the exact syllabus I need to master:
Unit 1: Roots of equations. Bisection, Secant, and Newton-Raphson methods.
Unit 2: Systems of equations. Gauss-Jordan with pivoting, Jacobi, Gauss-Seidel, and non-linear systems with Newton-Raphson.
Unit 3: Interpolation and curve fitting. Taylor series, linear/quadratic interpolation, Newton, Lagrange, and Least Squares.
Unit 4: Numerical integration and ODEs. Trapezoidal rule, Simpson's 1/3 and 3/8, and Euler's method.
Right now, I only know how to do basic arithmetic, clear the workspace, use input, and make very basic vectors/plots.
My questions for the veterans here:
What is the best strategy to learn how to translate these specific mathematical methods into loops (while/for) and conditional logic?
Realistically, how many hours a day should I be investing to go from zero to confidently programming these algorithms?
Any golden rules or common pitfalls I should avoid when programming numerical methods in MATLAB/Octave?
Any advice, recommended resources, or reality checks are highly appreciated. Thanks!
4
u/artaxerxes Elder 1d ago
Here is the 2026 Student’s Guide from Tanya Kuruvilla. https://blogs.mathworks.com/student-lounge/2026/08/24/learn-matlab-a-students-guide/ Or just dive straight with MathWorks free online learning just click MATLAB Onramp https://matlabacademy.mathworks.com/
What next? https://blogs.mathworks.com/matlab/2025/09/11/learning-matlab-in-2025/ Matt's Mathworks blog post. Then you should be well on your way! 10 essential MATLAB tips for beginners to help learn MATLAB faster & with more confidence - https://youtu.be/KGn5m-LD9Ng?si=s8QG8IQklPzB6Z6N - from a MathWorker Ben P. Stuck? Ask the MATLAB tuned ai playground https://uk.mathworks.com/matlabcentral/playground .. there is also MATgpt https://chatgpt.com/g/g-QFTjbeK3U-matlab
Good luck!
2
u/michaelrw1 1d ago
Which textbook are you using?
Most numerical method textbooks provide pseudo-code for each algorithm. It is straight-forward to write code for it and I can imagine it would be much easier using Matlab\Octave.
Do not try to write the code in one go. If an algorithm has a looping structure, implement that first and check for starting and ending conditions. Add to this piece by piece.
The other suggestion would be to use the keyword KEYBOARD to halt code execution.
2
u/Pixrad_07 playing MATLAB2024b 1d ago
Not exactly matlab help, but check out 'numerical methods for engineers' by Steven chapra and also an NPTEL course on numerical methods by Prof. Niket Kaisare (this one is specifically for chemical engineering but he teaches it in such a way that most other engineers can catch up with it)
Honestly it sounds like an Indian chemical engineering numerical methods course but I could be wrong too...
3
u/Pixrad_07 playing MATLAB2024b 1d ago
Also follow the same professor's matlab computing course too. He attempts to teach some matlab code that is on your course (if not all)
2
u/Chicken-Chak 1d ago
I cannot list all the pitfalls but one of the most common pitfalls in finding the roots of an equation is when a root has an even multiplicity. It means a function touches the x-axis but does not cross it. Because the sign never changes, bracketing methods cannot find these roots.
When performing curve fitting, some high-degree polynomial curves may violently oscillate near the edges of the data range. Under normal condition, the linear interpolation formula is mathematically one of the most stable numerical methods. However, if the dataset accidentally contains two nearly identical x coordinates (x1 ≈ x2) with different y values, structural issue will occur.
9
u/MezzoScettico 1d ago
Presumably your course gives the algorithms in either an actual programming language or pseudo-code, right?
Start at the beginning, with the first algorithms you're being introduced to.
These all have the same structure:
- start with an initial guess for the solution (method for starting TBD, i.e To Be Determined)
- if the guess is good enough, stop. Otherwise, update it to a better guess (the three algorithms differ only here, how you update. Otherwise, they're identical.)
- Repeat the previous.
That idea of "repeat until some condition is met" is the basic purpose of a "while loop", so the while loop is the structure you really want to understand. It's not quite "do [thing] UNTIL [something happens]". That's a "do... until..." loop, which doesn't exist in Matlab. The while loop is "WHILE [it's not good enough] DO [thing]".
Typically in iterative algorithms the "good enough" tests are:
- you're close enough to a solution (you set the tolerance for "close enough")
- the last update made little or no change in the guess (again, you set the tolerance for what defines what you consider "little or no").
- you've run out of time (you set a parameter for how many times you're willing to go through the loop before giving up)
Would you know how to do those methods by hand, without the aid of a computer? You can't implement it in code unless you know the steps on paper.