navakris03
Posts: 3
Joined: Fri Jun 01, 2012 1:40 am

MATLAB

Fri Jun 01, 2012 1:50 am

Hi there

A novice in Pi family. Is it possible to run MATLAB for Linux on the Pi or any other alternative that can offer the simulations to be programmed and run on the Pi?

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4257
Joined: Mon Jan 09, 2012 3:16 pm

Re: MATLAB

Fri Jun 01, 2012 6:45 am

MatLab itself will not run. There is not enough memory, not enough power and they almost certainly do not support the ARM processor.

There is a possibility that MatLab Compiler could generate code to run on the Pi, but it requires the MatLab Compiler Runtime, and I don't believe that will be available for the ARM. It might just be possible to get source-code for it, but I somewhat doubt it. You could ask Mathworks if the Matlab Compiler Runtime will support the ARMv6 under Debian Linux. They'll be able to answer that easier than if you just talked about the Raspberry Pi.

It is almost certain that you could use Simulink Coder to produce programs to run on the RaspPi, since that produces pure C. (If I remember correctly -- you may need Embedded Coder too and it's best to check with Mathworks before spending the huge amount of money that they cost.) But of course that isn't the whole of MatLab, just the Simulink bit.

navakris03
Posts: 3
Joined: Fri Jun 01, 2012 1:40 am

Re: MATLAB

Fri Jun 01, 2012 9:29 am

Thanks mate !

My primary work is MATLAB based. running Simulations and stuff. So was wondering about the possibility of Pi supporting though i knew the processing capabilities of Pi is not that high as any simulation package like MATLAB would demand.

Any other alternatives to do calculations and mathematical evaluations on the Pi? I have heard about octave before but never tried it. Suggestions please

yeahbox
Posts: 36
Joined: Sun May 27, 2012 10:35 pm
Location: Manchester, UK

Re: MATLAB

Fri Jun 01, 2012 9:42 pm

navakris03 wrote: Any other alternatives to do calculations and mathematical evaluations on the Pi? I have heard about octave before but never tried it. Suggestions please
What are your requirements? Do you need Simulink? Are you a heavy user of the MATLAB toolbox GUI stuff? If yes then I can't help. But if your code is mostly just code and functions then Octave is syntax-compatible which means that your scripts would run with maybe some tiny modification.

If you want another alternative then Python + numpy + scipy + matplotlib is an excellent combination and I've read somewhere on these forums that it is working on the RasPi. You'll also get the bonus of python being a proper object oriented language. I did this "switch" some years ago and I do not want to go back to MATLAB/Octave.

Funar
Posts: 16
Joined: Fri Mar 23, 2012 4:50 pm

Re: MATLAB

Fri Jun 29, 2012 11:50 am

I recently attended a MATLAB / Simulink seminar, which was excellent by the way, and part of the agenda covered control of robots, motorised webcam for image processing, etc. It turns out that even the basic student edition of MathWorks software (http://www.mathworks.co.uk/academia/student_version/) allows algorithms to be developed and run on low cost target platforms. They support BeagleBoard-xM, Lego MINDSTORMS NXT, Arduino, etc.

When discussing BeagleBoard I asked them if they plan to support Raspberry PI. The applications engineer knew all about RPi but didn't know if MathWorks were going to develop a board support package for it.

Personally I think this could be a match made in Heaven, particularly on the academic side as the price for the student version in the link above is a steal for what you get. With the sophisticated graphics hardware on the RPi this could be a very capable platform for some very impressive real time control and signal processing algorithms, including webcam and audio work. Have a quick look at this for a teaser. http://www.mathworks.co.uk/academia/beagleboard/

I'm not sure if this is the correct forum, but could the Foundation please make contact with MathWorks and figure out if this is a possibility?

LandyManLuke
Posts: 17
Joined: Tue Jun 05, 2012 9:45 pm
Location: Shropshire, UK

Re: MATLAB

Fri Jun 29, 2012 12:16 pm

FWIW, I approached this a different way.

It it possible to write a Simulink block using C code. This means it is possible to create an environment where you can run the same C code as you would run on a microcontroller (Atmel Atmega32 last time I did this) in the block in Simulink.

This means you can write and test your C code in a simulated environment, and then transfer (most of) the C code directly to the microcontroller, or Pi.

Regards,

Luke

Funar
Posts: 16
Joined: Fri Mar 23, 2012 4:50 pm

Re: MATLAB

Fri Jun 29, 2012 1:11 pm

True, Luke, and it depends on what you are doing. For number crunching stuff your approach would work very well. Buying Simulink Coder can do this very well too as it automatically generates C/C++ code for compiling and running on the hardware platform stand alone.

But for rapid prototyping and hardware-in-the-loop type development, the hardware runs the code in real time with access to real world acquired data. If MathWorks supported RPi as one of their low cost platforms without needing Coder, which is really expensive, it would be a massive step for this platform. For higher level education it would be huge.

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm

Re: MATLAB

Fri Jun 29, 2012 1:44 pm

navakris03 wrote:Hi there

A novice in Pi family. Is it possible to run MATLAB for Linux on the Pi or any other alternative that can offer the simulations to be programmed and run on the Pi?
Scilab is an alternative that is know to run on even less capable hardware compared to the Pi, scilab is also found in the debian package manager.
sudo apt-get update
sudo apt-get install scilab
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

ibeeby
Posts: 10
Joined: Mon Jul 02, 2012 7:04 pm

Re: MATLAB

Tue Jul 03, 2012 6:16 am

Octave would be my tool of choice for this device - it is available at source code level and the compilers are already installed - so it should be simple enough to run the make file. There are many many sources of help for MATLAB users wishing to divest themselves of the burden of a licence fee to try Octave, which has many compatibilities.

Performance will be another issue - it may be that some work has to be done to harness the GPU power to assist computing as the RPi is fairly pedestrian - but that is for another day...

Ian

m4r35n357
Posts: 155
Joined: Fri Jul 06, 2012 4:31 pm
Location: UK

Re: MATLAB

Fri Jul 06, 2012 4:33 pm

Yep, GNU Octave is the obvious choice, I'll be attempting to use it when my PI arrives. Ditto comment re. performance.

Funar
Posts: 16
Joined: Fri Mar 23, 2012 4:50 pm

Re: MATLAB

Mon Dec 03, 2012 3:38 pm

No promises from MathWorks, but something may be happening behind the scenes for Simulink to support raspberry pi for rapid prototyping using hardware-in-the-loop development. I really hope so because this would be a huge step forward, particularly for educational use.

federicob
Posts: 5
Joined: Fri Sep 21, 2012 4:58 pm

Re: MATLAB

Sun Mar 10, 2013 10:33 am

MATLAB 2013a brings a proper support for Simulink on RPi, and the expensive Simulink Coder is not needed anymore.
Reading the documentation looks like you have to install a cusom raspian to be able to run Simulink models.
Unfortunately Windows is the only host supported, which is quite surprising to me.

tvoverbeek
Posts: 114
Joined: Mon Feb 04, 2013 9:50 am
Location: Fieberbrunn, Austria

Re: MATLAB

Wed Mar 13, 2013 9:40 pm

Just played with Matlab R2013a and the Pi.
The Pi (plus a lot of other ones like Arduino, Beagleboard) are only supported on the Windows version of Matlab.
They want you to use a tweaked Raspbian image, but I tried the examples with the normal Raspbian
installed on my PI and they worked fine.
Raspbian needs to have gcc, binutils, ssh, sdl, etc. installed.
The models running on the Pi are transferred in source to the Pi and compiled/linked there
(no need for an ARM cross compiler on the host). Transfering and commanding uses ssh.
Models running on the Pi can communicate with models running on the host using UDP.

As far as I can tell most of the functionality should also be able to run on OSX and Linux.
Do not know if the OSX and Linux versions of Matlab will ever be supported by Mathworks.

FYI I am using both the OSX and Win versions of Matlab.

mlundgren00
Posts: 2
Joined: Sun Mar 17, 2013 3:19 am

Re: MATLAB

Sun Mar 17, 2013 3:40 am

I took a look at the R2013a Raspberry Pi support from MATLAB / Simulink as well. The MATLAB solution allows one to run Simulink models on Raspberry Pi. You only need MATLAB and Simulink. There is a GUI guided setup for Raspberry Pi which I found very easy to follow. The GUI helps you create an SD card with a Raspbian Wheezy Linux. There is a nifty feature where Raspberry Pi speaks its IP address upon boot. These guys also found a way to write the IP configuration (DHCP vs Static) onto the SD card so you do the IP configuration when you are creating the SD card. I use static IP and I found this much easier than going into /etc/network/interfaces files and typing away after boot. There is also a nifty feature where Raspberry Pi speaks its IP address when booting through speakers. I think they are using eSpeak for this. They also configured the board to send the IP address via e-mail if needed. Very convenient.

As far as the Simulink blocks are concerned, you have UDP, Video In/Out, Audio In/Out, GPIO read/write, LED and Text to Speech blocks. They also have a MATLAB class that enables executing commands on the Raspberry Pi from within MATLAB. You can for example run a Simulink model that logs data onto the Raspberry Pi and retrieve data back into MATLAB for analysis, etc. Overall pretty good for running advanced signal / image processing algorithms. I wish there were more peripheral access blocks such as I2C, Serial as well. I developed a coin counter using computer vision toolbox and ran it on the board (using hough transform). A little slow but hey It took me half an hour. I had some MATLAB code that I was able to run directly on Raspberry Pi by throwing the code into a MATLAB function block.

Next, I'll try to pair my RasPi with and Arduino. A robot is in order. Raspi will be doing high-level image processing and Arduino will be driving the motors.

mlundgren00
Posts: 2
Joined: Sun Mar 17, 2013 3:19 am

Re: MATLAB

Fri May 10, 2013 2:56 am

There is an e-book in amazon kindle store on using simulink support package for rasp-pi. Here is the link if anyone is interested:
https://www.amazon.com/gp/kindle/kcp/to ... s-bookmark

I also came across a cool project that uses arduino and rasp-pi to build a Segway type robot using simulink: www.minseg.com

infotorpk8
Posts: 10
Joined: Fri Jul 05, 2013 6:33 am

Re: MATLAB

Fri Nov 29, 2013 10:03 am

hi all,
i had tried scilab(Open source which is similar to matlab) on udoo..for installation steps click the below link.
http://blogspot.tenettech.com/?p=3045

regards,
praveen

jpbovee
Posts: 1
Joined: Sun Nov 06, 2016 12:17 pm

Re: MATLAB

Sun Nov 06, 2016 12:20 pm

You can use Scilab alternatively.
Scilab is open source and runs on Raspberry.
Most Matlab code runs on Scilab.

See by ex: https://www.youtube.com/watch?v=kPBlYGV2HxU

Return to “Other programming languages”