MATLAB Answers

3

How to learn MATLAB

Asked by amit jain on 10 Feb 2011
Latest activity Edited by Rena Berman on 9 Nov 2018
What is the best way to learn MATLAB at home without a tutor?

  5 Comments

Am referring https://hackr.io/tutorials/learn-matlab to find the best online MATLAB tutorial. Am I right in doing so or I need something else? Thanks.
Hi, I have written 5 introductory books for #MATLAB and its #opensource alternatives for numeric and scientific computing in general (using #Julia, #Octave , #Scilab and #Python).
Please check out the link
The website also host "Learning resources" having useful videos and links to other specialised books. Please have a look on these books and kindly share this information with your colleagues and fellow researchers. You may like to recommend the books for libraries too.
@sandeep nagar: I reviewed the free preview of your MATLAB book Introduction to MATLAB for Engineers and Scientists. It needs a good editor and to be reviewed by experienced MATLAB users, as it contains mistakes and is missing a lot of useful advice. For example:
  • 1.4.1: "When input is fed into the MATLAB command prompt, the Julia language..." What does Julia have to do with MATLAB? What does "fed" mean: does MATLAB require a sandwich for lunch?
  • It would help a lot format the text better, for example to use monospaced text to indicate code. E.g. 1.4.2 "By default, MATLAB works with the format short command", but this would be clearer with monospaced text: "By default, MATLAB uses the format short command", or placing the code on its own lines.
  • In fact this statement should be revised anyway: it would be more accurate to say the "the format is set to short" or similar, following the nomenclature used in the MATLAB documentation.
  • Get rid of the line numbering: it does not aid clarity, and does not reflect what users actually see in MATLAB. If line numbering is required then format it so that it is clearly not part of the code (e.g. a gray column).
  • 1.4.3 "A number of physical constants are defined: pi, e, ..." is incorrect: neither pi nor e are physical constants, and e is not defined in MATLAB (only exp is). You should revise what physical constants are (e.g. here or here).
  • 1.4.4 "... using the command clc, which clears the screen": clc clears the command window.
  • 1.6 Variables: "..we use variables that store the values at a particular memory location and address it with a symbol or set of symbols (called strings)...". This is highly misleading: strings are a data class in MATLAB, and are not related to the names of variables. I have never seen anyone refer to variable or function names as "strings": have you?
  • What is a "symbol" anyway? You don't define this, nor is this term used in the MATLAB documentation for variable names, and it is not a term I have ever seem used when discussing character sets (except for the specific subset of some character sets that might be called "symbols"). Why do you invent your own confusing terminology which is unrelated to what the rest of the world uses?
  • 1.6.1: "Complex numbers have real and imaginary parts, which are stored separately." is very ambiguous: what does that mean? Is a beginner supposed to know what that means in practice?
  • 1.6.2: "Names should not start with a number" is incorrect: variable and function names cannot start with a number.
  • 1.6.2: You omit the very important advice to use which before using new variable names. This is much more useful than iskeyword, which you go on about in some detail, yet would really help beginners to avoid basic bugs that we keep getting asked about on this forum. Clearly the author has not spent much time bothering to learn what common mistakes beginners make, and how to avoid them.
  • The next chapter is titled "Global and Local Variables", so apparently the bad advice will continue... why introduce beginners to bad practices when you are still on chapter 1.6?
  • Some thought needs to go into the choice of typeface and the overly bold text. The formatting is rather haphazard: using bullet-points is not synonymous with creating a clear document format.
  • The imprecise, colloquial language should be revised, e.g. terms like "fed" have no meaning in MATLAB (or in any programming language that does not use punch cards (perhaps it does in Chef?)). Using correct terminology makes information clearer, and makes the information transferable because it matches what the MATLAB documentation actually uses, and what other MATLAB users write.
Summary: Definitely not recommended. Confusingly written, with incorrect terminology, and in need of a good editor. There is simply too much half-baked advice, and it has clearly been written with more enthusiasm than expertise. It omits basic concepts that any experienced user would be aware of (e.g. which, avoid global variables, avoid multiple assignments on one line, etc).
I recommend that beginners instead start with the MATLAB introductory tutorials, which are better written, factually correct, use the correct terminology, and do not recommend pointless or bad code practices (e.g. global variables):
Also important is the online documentation, or downloading the PDF documentation:
There is no reason why beginners should not go straight to the source for the best information!

Sign in to comment.

10 Answers

Answer by Matt Tearle
on 15 Apr 2016

In addition to the online learning options Andreas mentioned, you can also get started in MATLAB by taking the free MATLAB Onramp. It teaches you the basics of MATLAB interactively -- you actually try out the MATLAB code and you see the results and feedback to help you.

  0 Comments

Sign in to comment.


Answer by Andreas Goser on 10 Feb 2011
Edited by Rena Berman on 9 Nov 2018

There are many options I can recommend.
IMHO, nothing can beat a real professional training. That is highly efficient and effective.
But you said you like to learn from home, so here are some ideas I can recommend:
  1. Get started with the MATLAB tutorials
  2. MathWorks E-learning courses
  3. You likely have a certain field of application you like to focus like Image Processing, Control Design, etc. If you choose a book from that field, you not only learn useing the products, but you apply it for later use.

  1 Comment

jiro
on 11 Feb 2011
I'd like to add that inside Andreas's first link, you'll find a link to the Getting Started with MATLAB Guide, which is also available in the MATLAB in-product documentation:
http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/bqr_2pl.html

Sign in to comment.


Answer by Sean
on 11 Feb 2011

I would respectfully disagree with Andreas about formal Matlab training. In my experience a training is extremely expensive and does not offer much that you cannot get by reading the documentation. In fact, in addition to reading, nothing has helped me learn Matlab more than doing small experiments at the command line and incrementally building on what I discover.
I would also suggest reading the CSSM newsgroup. Usually I do not even need to post a new question. Almost invariably, if what I need is not in the documentation (meaning there is not already an existing built-in solution--a remarkably rare occurrence) then someone has asked a similar question on CSSM. You can learn so much from the way others attack a technical problem.

  5 Comments

I agree. I've learned MATLAB pretty much exclusively from CSSM and by decoding functions on the FEX.
For explanation of what CSSM is, see separate answer.
Sean
on 11 Feb 2011
I used to work for Northrop Grumman, where I took both the basic and advanced Matlab training. Even in the advanced training, there was very little presented that my group not only already knew, but was required to know in order for us to do our work. We ended up starting our own internal training for new hires and general knowledge sharing. I enjoyed the training, and the instructor, but there was very little content that made it worth the significant expense.

Sign in to comment.


Answer by Igor
on 11 Feb 2011

In fact, in addition to reading, nothing has helped me learn Matlab more than doing small experiments at the command line and incrementally building on what I discover.
Yes.
And excelent help-system with "Getting Started"!

  0 Comments

Sign in to comment.


Answer by Bjorn Gustavsson on 11 Feb 2011

In addition to the other suggestions, may I suggest that you should also look through the matlab demos. There you get good examples of how a wide range of problems are solved. That way you can also focus on the type of problems that interest you at the moment, or just give yourself a very wide overview of what is possible. It will teach you plenty of good habits too. This in combination with experimenting and doodling (with lots of help of matlab's help function!) should get you going.

  0 Comments

Sign in to comment.


Answer by Loginatorist on 11 Feb 2011

This is the best general MATLAB book out there in my opinion, look at all it covers in the description. It is the book I learned with, and I highly recommend it.

  1 Comment

I'll also give this book a thumbs up.
Plus, if you buy it, you support my University!

Sign in to comment.


Answer by Andrew Newell
on 11 Feb 2011

CSSM is the Matlab newsgroup (comp.soft-sys.matlab), which you can access using the newsreader. It might be more useful, though, to look at the FAQ first.

  1 Comment

Note that CSSM is no longer mirrored on MATLAB Central. You would need to find it from Google Groups, or some such source.

Sign in to comment.


Answer by muhammad alli on 1 Oct 2016

Dabbling yourself through little projects is how I would advise you go through it, the Mathworks website is an amazing resource, I wrote a book that's advertised here on Mathworks if you'd like some basics and fundamentals outlined, I currently teach Matlab at my University and think that minimalist unambiguous examples are the best. Check out my book if you like.

  0 Comments

Sign in to comment.


Answer by Taylor
on 22 Feb 2017

The recommendation I received (but have not yet tested) is to pick a simple question and then try to design code for it. Many of the professions I know who use it say they taught themselves how to use MATLAB.
Taylor

  0 Comments

Sign in to comment.


Answer by John D'Errico
on 1 Mar 2018
Edited by John D'Errico
on 1 Mar 2018

My own take on learning MATLAB is to use it. Play with it. Try things out. If you don't know how something works, then read the help. (Doc is more complete than help.)
If you are really just getting started, then the getting started tutorials are a good thing to read.
A good resource is to use help on a directory name. For example, the matrix functions are found in the matfun directory. So try this in the command window:
help matfun
matrix functions - numerical linear algebra.
Matrix analysis.
bandwidth - Matrix bandwidth.
isbanded - Determine whether a matrix has certain bandwidth.
isdiag - Determine whether a matrix is diagonal.
ishermitian - Determine whether a matrix is Hermitian.
issymmetric - Determine whether a matrix is symmetric.
istril - Determine whether a matrix is lower triangular.
istriu - Determine whether a matrix is upper triangular.
norm - Matrix or vector norm.
vecnorm - Vector norm.
normest - Estimate the matrix 2-norm.
rank - Matrix rank.
...
Lots more will appear. If a function interests you, and you think it may prove useful. Click on the name. Each function name is a link to the help for that function.
Now do the same thing for other directories.
help strfun
help polyfun
You can also go into the doc tools like this, using
doc matfun
doc strfun
doc polyfun
So as you are getting started, EXPLORE MATLAB. Wander around. Poke your head into things. Try out any demos you may find.
As you get more sophisticated, you can try things like Cody, found on MATLAB Central. This will drive you to solve simple problems. Be careful though, because Cody can teach you some bad habits too to try to super-optimize your code to be as short as possible. Ultra-short code is rarely truly good code, as it can be difficult to read.
Other things you can do are to try to solve problems from external sources. For example Project Euler has some fascinating problems, some of which are truly difficult. With only moderate effort, you should be able to get through at least a hundred or so. (When last I checked, my personal count of problems solved was up over 300 or so, so many problems there are eminently doable.)
Other things you can do are to read Answers. You can learn a lot by reading advice from experts with the language.
If others that you work with also use MATLAB, other students, etc., then talk with them.
In fact, I learned MATLAB by using it, by working with others who used it on the same types of problems I needed to solve.
Remember that different people learn differently. Some will be best off reading a good book on the subject. There are lots of them out there. Personally, I'd just look online and read the reviews for any book that caught my eye. No matter what, you will want to get your hands dirty. Try things out.
Finally, always remember that advice you get from online can be suspect, just as advice you get from your friends at work or school. Not all users are experts.

  0 Comments

Sign in to comment.