i have a small problem on whether matlab or c++: which 1 is more adequate to an enginnering student like my self, for controlling industrial equipment? And where do i start in Learning the damn language?
First time I hear of somebody wanting to choose between Matlab and C++.
Well, both of different requirements and functionalities. Matlab helps in as a mathematical tool. This is rather an understatement because the re are many things an engineering an engineer can sort out using Matlab. But then all these are theoretical stuff and not realtime. C++ is programming language. very powerful and can help you anything you want as long as you have a processor and its surrounding "life support systems". This means you can also do what you could do with Matlab but then you have to scratch your head a bit and definitely can control devices and equipments ..provided they have a processor. But then trying to use C++ when there are thousand and one products which help you do the control in much easier manner is my opionion like reinventing the wheel.
if you are looking a matlab only for programming purpose then i will suggest you to go with C++ package because it enhanced your logic & creativity. there is more beneficail for you and if you have sufficient knowledge of C or C++ then definately you should go for Matlab. as it has very powerful programming language itself. for further information please call us.
Matlab allows you to use simulink and can acquire real world information and helps you process that information with a large library of functions. it is expensive. it also allows you to generate a c++ wrapper for use in stand alone apps. it is a language suited more for mathematics than for programming. depending on what modules you have you can compile code for certain DSPs and do all manner of analysis that in C you would have to implement yourself (and then somehow test to know your doing it right with no errors).
C++ is a variation of the C language. compared to basic C is not an easy language. however it's a fast one and a very powerful language. unlike other languages it doesn't check many things for you as it assumes that what you want to do is what you said to do. errors in c can be very subtle, and due to coding shortcuts and such, can be hard to find. with it you can access any port on a computer or even your own cards in slots. the only limitation in C is your ability. though note, that people make a living just working in C and doing nothing else.
one gives you speed and control with all responsibility in your hands (C++).
the other sacrifices speed and provides some simplicity to complex tasks with another sacrifice to ability.
the real decision is up to you and what you plan to do and how much you plan to do by yourself.
this is not an easy choice and each environment is programmed differently and has a different approach.
As a general reply (since the Question is very general), I can only give some tried and true tests as to which software protocol is better.
.good general purpose application language
.direct access to system at hardware level
.runs on virtually any control or target platform
.direct control over all aspects of software
modification and enhancements
.enormous learning curve for all but the
most trivial projects
.notorious security issues (memory leaks,
garbage collection problems, etc.)
.limited capabilities for RT and simultaneous
event processing (which is a particular
consideration in a closed feed back loop
.requires an intimate knowledge of the
.Has packages/libraries specifically designed
for general control applications
.Has built in contructs to handle low level
addressing of hardware.
.English language like commands
.While "easier" to learn than C++, you can
still anticipate a steep learning curve
.if your project has specifications that do
not fall within the capabilties of the
of the control, signal processing or other
prewritten software , you may need to
interface with custom code that you may not
have the ability to understand or write.
.Enhancement to basic product is expensive as
may be the basic system itself for
experimentation at the college level(A
capable student version is available)
.platform versions are limited to the most
popular commercial OSs
Obviously, school is the most comprehensive
way to learn programming. And courses are available in Matlab.
Books on C/C++ programming can be found
at any good book store or online. Some online
sites offer source code applications which allow
you to do while learning(no promise as to the reputability of code or sites)
Books on Matlab are also extensively available
though the same sources.The Matlab website gives
massive amounts of information on capability, applicability, and pricing on product lines.
Online tutorials are available through most product vendors and support sites( SUN, Cisco, Microsoft, ect).
So there the short version to your question.
Hardware specificity, OS environment and physical environment, are just a few of the "fail to mentions" which play an important part in my answer.
Well nobody talks about performance in here but I think it's a critical point. Matlab is designed for engineers, so you can start writing a program very quickly and pretty easily. When the program becomes very large and requires more and more resources, I think Matlab does not perform very well and it becomes interesting to switch to C++.
Matlabs real time extensions to simulink run on dedicated hardware or compiles to fairly efficient C code. I doubt performance is a real issue.
Have you considered a simple plc (eg twido) or modbus io hardware along With a open source modbus library is scan rate is low (10 hz). These exist for ruby, Python or Java free of charge. Learning ruby is a lot faster than learning C++. Java also works really well if you need matlabs math functionality
For systems not time critical why not consider a small plc or modbus io library along with scripting in ruby (rmodbus gem) or Python... Simple free and open source, and gets the job done in many cases. If your scan rate is 1000hz you shoul choose C, 10 hz choose scripting
If you depend on matlab math functionality, it interfaces quite well with java, so a Java modbus library might also be feasible running directly from your matlab script
estimate spending a lot more time learning C++ compared to ruby.
In reply to Tallak tveide: I'm not sure where you are getting your scan rate numbers from or what you would have the system doing in a scan, but my own measurements for a Python Modbus/TCP library show a polling speed of at least three orders of magnitude faster than the numbers you are using. Any bottleneck is more likely to be the field I/O itself than the software.
As far as math capability is concerned, the "numpy" and "scipy" libraries for Python have pretty much anything numerical that you could imagine. They are also very fast (as well as being free).
MATLAB and C++ both have their advantages; it is difficult to compare these two programming languages. For examples, when you want to build the decision tree, you need to share some space in advance before you creating the trees; for the MATLAB, you could construct the trees as you like without pre-spend some space for it. For the deep learning algorithm, C++ could directly program in GPU, but the MATLAB do not contain these functions.
If we compare both then we find Matlab code is much easier to read and much shorter than C++, and Matlab code can be correctly executed without compiler.C++ compiles directly to a machine's native code, allowing it to be one of the fastest languages in the world, if optimized; MATLAB: A high-level language and interactive environment for numerical computation, visualization, and programming.
Here I share this because I had faced problem when using C++.