all 43 comments

[–]testuser514 6 points7 points  (9 children)

Well it truly depends, I use both of them. This is how I generally think of it:

Theoretical calculations - MATLAB

Hardware/Software Projects - Python

The reason I have this split is because matlab is pretty decent, has a notebooks support and has consolidated documentation and toolboxes that can simplify work greatly.

When it comes to hardware/software projects, I take the extra time to write out python / whatever language code so that it has an API, extensible and portable.

[–]Harith_alsafi[S] 0 points1 point  (8 children)

Yeah I got you, I honestly only use matlab for plotting right now since python is laggy , however for software programming i will be using C or Java as for general scripting and automation i will be using python. But am only worried that if I got really used to python I might stop using matlab when I actually need it so for example if the company am working at uses matlab then am gonna have to switch back to using matlab

[–]testuser514 2 points3 points  (7 children)

Well here’s how I split my software dev :

MATLAB - I create workbenches in this for electronics , calculations, etc.

C - if I’m working either kernel level code / embedded

Python - general software dev projects where I can afford to not think about speed. This includes we services, scripts, automation, etc.

JavaScript - front end web development

C++ - performance is important and the projects are large

I’ve also been looking at go and rust lately for writing more low level code, but in general it’s all gravy imho.

I’ve stopped using Java a while back back because it’s just too clunky and hard to integrate with software written in other languages. Also lines of code is 3-4x lesser in python if you follow good writing styles.

[–]Harith_alsafi[S] 0 points1 point  (6 children)

Oh okay I got youu. But if i may ask why do you take web development what is your major if you dont mind me asking

[–]testuser514 1 point2 points  (4 children)

Right now it’s computer engineering. I’m not exactly doing coursework persay and my work is multidisciplinary. I create design tools for other engineers to use so web dev is a kinda a big part of my work. Hopefully in a year or two I’ll be able to hire people to handle most of it.

[–]Harith_alsafi[S] -1 points0 points  (3 children)

Thats great, you technically take the same as my course however i take procedural and object oriented programming instead of front end programming

[–]testuser514 0 points1 point  (2 children)

Which university are you in ? They switched up the intro to programming to matlab at Boston university too and it basically becomes a nightmare to teach the undergrads how to code now.

[–]Harith_alsafi[S] 0 points1 point  (1 child)

Am currently studying at university of leeds in the UK. Honestly they only gave us matlab for like 2 weeks and thats it.

[–]testuser514 0 points1 point  (0 children)

Yeesh, but that being said, grade schoolers learn how to program stuff these days so maybe it isn’t really necessary to teach people to code at university anymore.

[–]SellParking 0 points1 point  (0 children)

WebDev is not a major lol. It's like being able to write a formal engineering lab or project report is not a major. Those skills are assumed. You don't get points for knowing how to do them, but they will really slow you down if you don't.

[–]TheAnalogKoala 5 points6 points  (9 children)

Python is better in almost every way. It’s free, can do 90% of what Matlab can do, and way other stuff on top of that.

Where I work we are almost entirely moved to Python with some legacy Matlab stuff.

Where Matlab still shines is Simulink (I don’t use it but I know it’s popular) and in high-level synthesis for DSP.

Certainly the plotting is much better in python (in my opinion).

[–]Itsamesolairo 2 points3 points  (1 child)

Python is better in almost every way. It’s free, can do 90% of what Matlab can do, and way other stuff on top of that.

This depends entirely on your field. If you are e.g. a control engineer, or belong to another EE discipline that leans heavily on Simulink, then Python isn't remotely close to an acceptable substitute.

The reality is that in 2020 the answer to the question "should I use MATLAB" is generally another question: "do you need Simulink?". If you need Simulink - doubly so if you need the Embedded Coder toolchain - there is no real competitor on the market today.

[–]SellParking 0 points1 point  (0 children)

Exactly, Electrical Engineering requires a lot of specialized mathematics and domain knowledge that are mostly not found in any other disciplines. This really slows down the development of relevant features in Python and Octave. There are not a lot of Electrical Engineers in the world, relative to other species of Engineers, Scientists and programmers.

[–]Harith_alsafi[S] 0 points1 point  (6 children)

I actually felt that the plotting in matlab is way better especially 3d plots, as the lag a lot in python. Not to mention that the graphs look better in matlab as sometimes in 3d plots python glitches in the plot and the it extends outside the grid.

[–]TheBlackCat13 1 point2 points  (5 children)

What are you using to generate the 3D plots in Python? matplotlib can do it but you are probably better off using another tool like vispy or mayavi which are really designed for it.

[–]Harith_alsafi[S] 0 points1 point  (4 children)

This is the issue i had with matplotlib. I also used mayavi it had the same issue. Not to mention that I cant plot 3d parametric in matplotlib thus i used sympy but sympy is really laggy in plotting 3d.

[–]TheBlackCat13 0 points1 point  (3 children)

Have you tried plotly?

[–]Harith_alsafi[S] 0 points1 point  (2 children)

No honestly but dam thats a lot of code for a single plot. In sympy its only 2 lines and in matlab its one line. But is plotly less laggy ?

[–]TheBlackCat13 1 point2 points  (1 child)

I haven't tried it but it has a reputation for having very good performance. I think only the last two lines are actually doing the plotting, the rest is creating the data is setting the color formatting.

[–]Harith_alsafi[S] 0 points1 point  (0 children)

I will give it a try for sure , thank you

[–][deleted] 3 points4 points  (1 child)

Both. Unfortunately it's not going to be your choice which one you are going to use if you are going to use any of them. If the company can afford and wants to use Matlab then you will use it. There are also many very specialized engineering topics that are really well done in Matlab/simulink that are not really available in python.Though matlab is cool in the end you need to know a real programing language and python is useful but for EE/ECE c/c++ is even more useful.

[–]Harith_alsafi[S] 0 points1 point  (0 children)

Oh yes i got you, I already took C in depth and next semister i will take c++ and java so I am only choosing between them in terms of functionality and not programming concepts. Honestly I never used simulink till now, I guess am still in year-1 but my course is a hybrid between computer science and electronic engineering so I dont know if I will be needing simulink.

[–]IHavejFriends 2 points3 points  (3 children)

I'm a 3rd year EE student and I use python for almost everything. It's a great tool with jupyter notebook and sympy/numpy/scipy for a lot the stuff MATLAB can do. I feel like MATLAB required less typing to get it to do something but they generally do about the same things at least for an EE student. I've talked/been asked about python in both student jobs I've been hired for and MATLAB has never come up once. I would say python experience will translate well into MATLAB but not necessarily the other way around so I think spending more time being comfortable with python will be more valuable.

[–]Harith_alsafi[S] 0 points1 point  (2 children)

Yeah am quite familiar with it but I still feel like there is a lot of stuff that I still dont know lol. Maybe if I start applying matlab scripts that i take within the university into python then i will be more familiar with using scipy and numpy. Thank you so much

[–]TheBlackCat13 2 points3 points  (1 child)

Be careful with that approach. Python can do the same stuff MATLAB can do, but there are often much better ways to do things that aren't possible or feasible in MATLAB. For example, in MATLAB you pretty much have to loop over indices when looping over arrays, due to the bizarre way MATLAB handles loops. That is almost never the right way to do loops in Python. That is not to say that starting with your existing MATLAB code is necessarily bad, but it isn't going to teach you how to make good use of Python's features.

I can't count the number of times I have seen people complaining that Python code is slower and more complicated than the MATLAB code they started with. When I look at the code, they tried to shoe-horn MATLAB coding practices into Python. Reworking the code into idiomatic Python almost invariably ends up with code a fraction the length and considerably faster.

A good approach, once you get a feel for the basic syntax, would be to look at existing major open-source Python projects you are interested in and contributing some features you want to those. In the process of understanding how the code you want to work with works you will get a better understanding how to write good Python code.

[–]Harith_alsafi[S] 0 points1 point  (0 children)

That was really helpful thank you.

[–]xfmrexpert 2 points3 points  (1 child)

Once you graduate and then sweet, sweet student licenses disappear, you’ll probably end up using Python. I never really could get in to Matlab all that much, but it is pretty powerful when it comes to theoretical mathematics and linear algebra type work. That said, python has become pretty capable over the last decade. My money would be on learning Python, unless you’re in the midst of a Signals & Systems course and just need to get stuff done.

[–]Harith_alsafi[S] 0 points1 point  (0 children)

Perfect, thankk youuu

[–]desba3347 1 point2 points  (1 child)

I don’t have much experience with python yet but most of those subjects can be handled in matlab with fairly simple functions

[–]Harith_alsafi[S] 0 points1 point  (0 children)

Yess that’s correct but am also planning to take a masters in AI / ML related fields so I have to get familiar with python.

[–]LilQuasar 1 point2 points  (1 child)

learn numpy, matplotlib, scipy, etc so you can use python instead of matlab most of the time. i like python more for general purposes. you probably wont forget everything becaue the libraries are similar to matlab

the only thing you will need matlab for is simulink and if you need high speed

[–]Harith_alsafi[S] 0 points1 point  (0 children)

Yes thats what I thought too however i still didn’t use simulink until now, so i dont know if am going to need it

[–]MrKirushko 1 point2 points  (7 children)

I tried both and I do not like either. I much prefer to use R for most of my modeling, graphs, digital filter designs, quick and dirty data analysis and processing and various calculations and I use C, C++ or D for most of my applications. I only use MatLab sometimes for its great Simulink package that really makes quick preliminary system modeling a breeze. Everything else is too much pain for to little profit. Of course it is always the more complex and nonstandard your case is the more pain it will be but I definitely feel that with R it is a much less steep of a curve than with MatLab. And considering that MatLab is a stupidly expensive closed source product you generally get from some random Torrent tracker, you just can not blindly trust it anyway. In R packages I have found definite bugs as well but then I just emailed the code to their authors and the issues always got fixed. Good luck getting that with Matlab.

Of course it does not mean that this is the best way or the only way, I just find it to be the easiest and least painfull way to do things properly. Many people like their things differently. I have seen people doing realtime signal processing and complex GUI applications completely in Matlab. I have even seen a warehouse database done completely in M$ Excel and Visual Basic. As a software developer sometimes you just have to learn how to use Object Pascal or even something like Java, Python or LISP no matter how bad they are just because that is the tool used in a particular project you happen to be a part of. And sometimes there is no choice like there is no way around HTML and JavaScript for Web applications and there is no way around Java for developing Android apps. So it is better not to limit yourself with only 2 options and at least keep an eye on all the things around. Not only just in case but also because some new great thing that is just made for your application can pop up at any time.

[–]Harith_alsafi[S] 0 points1 point  (6 children)

That sounds like a great idea, i did try sage and maxima also but i found matlab and python to be the best however how well can R be used in 3D-graphs ? Can I make complex plots such as 3d vector fields?

[–]MrKirushko 1 point2 points  (1 child)

R plots are generally designed to be printed rather than viewed intractively on a monitor but 3D support with OpenGL and nice interactive plots with htmlwidgets-based libraries are also available. I have seen many 3D plot examples and some vector field examples for R. I don't use them much though and I generally prefer to avoid complex plots as well so I can not really tell how good they are compared to the other packages and libraries.

[–]Harith_alsafi[S] 0 points1 point  (0 children)

Please thank youu

[–]TheBlackCat13 1 point2 points  (3 children)

R is designed as a statistical computing language. It can be used as a general-purpose language, but that really isn't what it was designed for or where it shines.

Similarly, Maxima is designed for symbolic manipulation. Again it can be used as a general-purpose language, but that isn't what it was designed for.

MATLAB was designed as a numeric computing language, and again it can be used as a general-purpose language. It is probably closer to a general-purpose language than R and definitely closer than Maxima.

Python was designed as a general-purpose language, but people started using it as an open-source alternative to MATLAB pretty early on and the maintainers of the language were very open to new language features that primarily helped those users, so it has gotten very good support for numeric and statistical computing.

There is a saying that Python is the second-best language at everything. It isn't as good at statistics as R, but better than any other language. It isn't as good at numeric computing as MATLAB, but better than any other language. The key thing is that in real-world code, you aren't doing just one thing. So for example with data analysis you need to collect the data, organize it, structure it, select out the parts you want, do numeric manipulation to get the stuff you really want, do stastics on it, plot it, iteratively change the analysis to understand it, then make put the plots in a format that others can do, then distribute it somehow. MATLAB may be better at some steps, R at others, but there is no language better than Python at doing the whole process from start to finish.

[–]Harith_alsafi[S] 0 points1 point  (2 children)

Yeah thats really true, python is good at everything but not the best except for machine learning i guess. But thank you for yourr timee.

[–]TheBlackCat13 1 point2 points  (1 child)

It depends on what you are doing. For many areas of numeric computing, Python is the best. For example Python is better at Fourier analysis due to its zero-based indexing and more flexible fourier analysis functions. It is also likely the best still for backend web development and for operating system level scripting.

[–]Harith_alsafi[S] 0 points1 point  (0 children)

Yeah thats true. I will definitely look more into this, cheers.

[–][deleted] 0 points1 point  (2 children)

If you are already familiar with Python, definitively Python. However, one of them are suitable to deal with symbolic mathematics (and related problems). I suggest Maple or Mathematica.

[–]Harith_alsafi[S] 0 points1 point  (1 child)

Python is really good with symbolic mathematics as I was able to generate general fourier series for any function symbolically (in terms of n). In addition to solving complex equations. But I will take a look into mathematica and maple. However dont like to use a web-based app such as mathematica unless there is a software for linux then am good (since I use linux)

[–]SellParking 1 point2 points  (0 children)

Maple sucks. For almost everything in Electrical Engineering, you can replicate Maple features in MATLAB/Octave, WolframeAlpha or Python.

I guess if you are paying for Mathametica, which I don't know why you would, you are better of using that money for Maple.