Matlab For Beginners Pdf

0 views
Skip to first unread message

Emerenciana Mcgreal

unread,
Aug 4, 2024, 8:28:56 PM8/4/24
to arylniquan
MATLABis a programming language developed by MathWorks. It started out as a matrix programming language where linear algebra programming was simple. It can be run both under interactive sessions and as a batch job. This tutorial gives you aggressively a gentle introduction of MATLAB programming language. It is designed to give students fluency in MATLAB programming language. Problem-based MATLAB examples have been given in simple and easy way to make your learning fast and effective.

This tutorial has been prepared for the beginners to help them understand basic to advanced functionality of MATLAB. After completing this tutorial you will find yourself at a moderate level of expertise in using MATLAB from where you can take yourself to next levels.


We assume you have a little knowledge of any computer programming and understand concepts like variables, constants, expression, statements, etc. If you have done programming in any other high-level programming language like C, C++ or Java, then it will be very much beneficial and learning MATLAB will be like a fun for you.


I've taken a course in C++ in my freshman year in undergrad. However once it was over I never employed it in any project or use. I am familiar with some average topics in C++ prior to where 'link list' starts. Once I got the opportunity to do my first project after Sophomore year, I was suggested by my prof. to learn Matlab which is widely used in mathematical and engineering projects. But I often hear from people that Matlab is not a language and that it can't take the place of any programming languages like C++, Java, Fortran etc. I am also concerned about its inability to run using executable files unlike Fortran, C++ etc.


First, I want to dispel of a myth. Matlab is used in industry. However, it isn't as common, and is pretty specific. It's often used for prototyping and proving mathematic analysis, not to deploy systems to customers. Once the smart mathematicians prove their ideas out in Matlab, it falls to developers to build a real system out of it. That real system is usually done in C,C++,Java and deployed to the customer.


Matlab has some really cool features, but as an industry programming language, I wouldn't call it top of the line. However, the syntax is probably closest to python. Python can give you true object oriented development, and has a much richer standard library to go beyond matlabs walls.


Read code, read questions on StackOverflow. Read blogs and books about programming concepts - how to structure code, how to refactor, how to design, etc. Then, just solve problems you encounter. If you can, find a mentor or ask a lot of questions on SO.


You're hearing nonsense. Matlab is a perfectly good language, if a bit strange to people who've been conditioned by FORTRAN, C, or C++. Also, it is heavily used in engineering and in many of the natural sciences. Your question as stated gives no good reason why you should go on to something else except the nebulous objections of people who sound like they have axes to grind.


I strongly recommend that you continue using Matlab until it stops being effective for you. At that point you will have a particular problem (scale, parallelism, performance, whatever) which one hopes will also be representative of problems you will encounter in the future. You'll be much better off learning a new language at that point than you will guessing what language might help you with unknown problems you might encounter in the future.


The syntax is relatively similar to Matlab (not exactly, but fairly easy to get used to).

You also have the matplotlib python library, which gives some of Matlab's functionality while trying to provide the same API (i.e. function names etc.). This could be a starting point for you to start using Python, while staying in a familiar ground.


Matlab is extremely widely used in industry for scientific and engineering computing. It has its faults, certainly, but it provides a good platform for rapid development of algorithms. I work in the oil industry with a team of research geophysicists; they all use Matlab all the time, developing computational electromagnetic codes. Defence, the car industry, increasingly the biosciences, and many others are heavy users of Matlab. Check out the job ads.


So if your sole concern is getting a job, I suggest that your next programming language should be Matlab -- it hits at least 2 of your 3 desiderata. I suspect that your understanding of Matlab's deficiencies is, in part, based on your lack of in depth knowledge of the product.


Having said all that, what do you want to learn another programming language for ? If you want to continue to develop sci/tech/eng programs then Fortran is a good choice, as too are C and C++. I'll leave others to support C and C++, since we use Fortran for the heavy lifting here.


The main advantage that Fortran has over Matlab is speed of execution; where I work that matters a lot, some of our computations take days on 100s of processors. Which indicates another advantage that Fortran has, which is that Fortran, through OpenMP and MPI (and similar) is one of the most easily parallelised languages around.


To learn modern Fortran, I suggest the book 'Fortran 90' by Ellis et al, and the book 'Fortran 95/2003 Explained' by Metcalf. Then, in your situation, I'd start translating some of my Matlab programs into Fortran. This will give you a good appreciation of the relative strengths and weaknesses of the two languages. Your Matlab programs also provide a good specification for what your Fortran programs are to do, so you have the tests already written.


Well Matlab is widely used in industry to do simulations and especially in R&D departments. Of course in a software company, you're not going to sell Matlab scripts if the client has nothing to do with Matlab.


1) Platform independant, easy to use. As you said, Matlab is a scripting language living in a software, so the advantages of any language over Matlab should be obvious. (If you're thinking about applications outside of the engineering / simulation world).


If that's the case, then the people around you are often wrong. Matlab is a real programming language. It's never going to replace C++ or Java because they're used for different things. But Matlab works quite well for the kind of work it's designed to do.


My recommendation is this: Find an industry you want to work for, look at the job listings, and see what languages they ask for. Then learn one of those. In my experience it's not too hard to learn enough to land an entry-level position, and then you'll learn a lot more during the course of your employment.


I'll often use python scripts to pre-process data that will be fed to Matlab (python parsing functions are much more pleasant to work with than Matlab's, in my opinion). Or I'll use python to simulate a process (since our production system is in C++ and python), and use the graphing and analysis power of Matlab to handle the visual display or the statistical analysis.


Also, as Stephen mentioned, in the industry, Matlab is often used in the prototype stage. The concepts are then translated to another languages; in my company, that other language is python, and translation from one to the other is generally very straightforward.


Ill just throw JavaScript into the mix here purely because it's the most widely installed language in the world. Its gaining momentum in non browser installations. I predict there will be a real shortage of quality JS programmers in the next few years.


Python has been mentioned a lot in the answers, so I'll just quickly touch upon R. R is free, open source software that is the de facto language for statistics and data analysis. It also has (imho) the best data-vis tools around.


You other option is to learn web-programming, since it is very useful to be able to share your research with others via a web app. Try some basic HTML coding, then look into a JavaScript framework like jQuery.


it is a little bit very basic for students with a background in programming but the problems specially close to the end was a little challenging which is great. overall it is a solid start with matlab


Access to lectures and assignments depends on your type of enrollment. If you take a course in audit mode, you will be able to see most course materials for free. To access graded assignments and to earn a Certificate, you will need to purchase the Certificate experience, during or after your audit. If you don't see the audit option:


The course may offer 'Full Course, No Certificate' instead. This option lets you see all course materials, submit required assessments, and get a final grade. This also means that you will not be able to purchase a Certificate experience.


When you enroll in the course, you get access to all of the courses in the Specialization, and you earn a certificate when you complete the work. Your electronic Certificate will be added to your Accomplishments page - from there, you can print your Certificate or add it to your LinkedIn profile. If you only want to read and view the course content, you can audit the course for free.


Hi,

Currently I'm working on 123 nodes distribution system. I need to bring the whole work in MATLAB platform. From the given examples I learned how to run the system in OpenDSS calling from MATLAB. But I need the Y Bus matrix also, which is under the Export tool in OpenDSS.

That's why, in my matlab code, after the command "DSSSolution.solve;" I added another command as "DSSText.Command = 'Export Y Matrix';"

The code doesn't give any error but I didn't get the Y matrix either in the folder. Can anyone please tell where I'm doing it wrong and how to fix it?

Thank you.


Update: I've found that the file actually was created but it's in the AppData folder. Is there any way to create or move it to the same directory where the mian matlab file is. I've tried the change directory command in matlab just before the DSSText.Comman line, it didn't help.

Thanks.

3a8082e126
Reply all
Reply to author
Forward
0 new messages