What is your unusual use of MATLAB?
Fangjun Jiang asked
on 8 Jun 2011
Latest activity:
Answer by Brian Concannon
on 21 Nov 2011
I remember reading a blog (maybe by Doug Hull) that someone uses MATLAB to send emails and check local weather. I am just wondering what is your unusual use of MATLAB. Maybe there is something that might surprise every one. In answering a question today, I found out that I can use MATLAB to listen to online music. system('C:\WINDOWS\system32\dllcache\wmplayer http://www.satelitemusical.net/mj-akon-hold-my-hand.wma')
Of course not really have to use MATLAB, but, it's cool. What is your usage? Products |
|---|
My cat likes to chase the laser pointer. Once the battery has run out and I wrote a few lines of code to give him the entertainment :)
Something like that (Lissajous curve):
figure('menubar','none','color','k')
h = plot(sin(sqrt(2)*0+sqrt(3)),cos(sqrt(5)*0),'r.','MarkerSize',20);
xlim([-1 1])
ylim([-1 1])
axis off
for t=0.01:.01:100
set(h,'xdata',sin(sqrt(2)*t+sqrt(3)),...
'ydata',cos(sqrt(5)*t))
drawnow
end
+1, Nice! I assume you have anti-scratch screen.
+1. If you have a laptop, I suggest to let a C-compiler convert the cat's keyboard access to a running program. If you sell it, reject a long-term support.
"C code looks like someone rolled an angry armadillo over the keyboard".
Fortunately, the cat doesn't stretch out his claws :)
This is funny, and kind of embarrassing to admit, but I use my timer function, remindme, to time my kid's corner time. If I am MATLAB-ing and there is a naughty behavior that warrants some corner time, I can simply set the reminder so I know I won't forget...
Very nice! I need to time myself on time spent on Matlab Answers recently.
@Fangjun; I prefer to do that qualitatively: "too much"
Then the example from the help would be of use to you:
remindme('1:20','There is more to life than Matlab.')
%Will issue the message to the user at the next occurence of 1:20.
So some time really late at night for those of on the east coast ;)
I don't have the issue of using it at home too much since I don't have a computer at home and only occasionally bring the laptop there. fminsearch(@(t)trapz(glowing_rectangle_exposure(t)),now);
@Matt: What will happen, if your kids are so naughty, that they modify the source of the remindme function? Do you use hashs to check the integrity of the sources? If you do and find the modification of remindme and fix the code again - is it still a "naughty" behaviour, although there are no consequences anymore?
You see, I'm applying Matlab to drive myself into philosophic problems.
Only you, Jan, would come up with that one!
My computer automatically goes to password protected screensaver after 3 minutes of idle time. I also have disabled the password and instead use the fingerprint reader as the login.
So if my 9 year old was somehow able to break in to the machine and modify the source code to REMINDME, I would be so proud that I would probably take him out to ice cream and a movie!
@Matt: The first thing my 3 year old son did with my computer was: reboot, change the order of boot media in the BIOS and turn off. I was outside the room for 5 minutes only. Imagine how long it took me to find out, why the machine did not startup anymore...
Since this day, I know that the infinite monkey threorem (see http://en.wikipedia.org/wiki/Infinite_monkey_theorem ) is just a theorem, which is only weakly connected to the reality.
@Jan: And I thought it was bad when mine deleted all of the icons off the desktop!
those kids are lucky to have such MATLAB experts for parents, someday they might also be here answering questions :)
That would explain the question I saw the other day on here about "How do I speed up a timer application from 5 minutes to 4 minutes?" :)
How good is your code during the period when the kids is in the corner yelling? Sterling I bet.
Using an uitable I enter every 2-3 days , the weight of my wife since 3 years ! Data are saved in a MAT-file. I use functions like polyfit to have a forecast of her weight in 1 week / 1 month. I also make some basic statistics like mean , min and max . I have called this utity "MATLAB fit". It worked fine until she was pregnant, the quadratic-polynomial fit became a polynomial of degree 10 ;)
I like this one!
I used Simulink and the very first version of the Video and Image Processing Blockset to identify a roaming cat that disturbed our sleep and - err - introduced a smelling front door.
It helped. After 3 days, the cat was identified and I could speak with the owner.
Excellent!
It would've been cool to set it up with a few speakers to bark at the cat as well.
And first see through pattern or color recognition if it the own cat. "If not ginger then bark"
@Andreas: I've interested in the arguments, the owners used to convince their cat to avoid your land property. "Stay away, he has undocumented 64bit tools!"
nice work, +1 vote
In winter I use MATLAB as a bed warmer. I run a infinite loop with a lot of calculus and huge memory swapping on my laptop while it is in bed.
That is ..., unbelievable!
I've used Matlab 5.3 on an old (a fanless 486!) laptop as babyphon: Record 10 seconds through the microphon, forward the sound through a 16 m wire to a small speaker, if the activity is over a specific level.
Sounds like what I would call a baby monitor! Jan, we have similar insights into the potential for MATLAB to be the next Graco!
Should we collaborate on a 'Parenting Toolbox'?
I cannot control the heap problems of Java reliably. For a baby monitor "reliable" means a MTBF > pi*6e7 seconds, because than the child is old enough to get up at night to shake the dad's arm and explain, that the silly computer asks, if it is allowed to download some security updates for Windows.
Therefore we need these conditions for the Parenting toolbox: 1. No internet connection, such that auto-updates can be disabled, 2. matlab -nojvm compatible, 3. a method to lock the keyboard without forcing the computer to fall into sleep.
For #3, get the freeware utility "Toddler Trap". It traps all the keys so that little fingers don't cause harm. I'm sure you could call it with system() or code a similar thing in MATLAB.
I used MATLAB and sunposition-m to calculate sun position and ray-traced the somewhen expected multi-story buildings around. Based on that I decided which real estate in our city to buy, the left one or the right one.
Hum, sounds like a complex task! Any interests from any real-estate agents?
I used it to perform texture analysis on the images obtained from a camera trained on the "Free Food Table" in the department, and send an alert whenever there was food present.
Does it work if somebody puts a picture of a banana on the table?
Real MATLAB programmers don't eat bananas ;-)
My question is tricky though. The answer could be:
No, it doesn't work!
Yes, it works!
I wrote a utility function taking as inputs the characteristics of a house (such as the location, neighborhood etc) and returning a score. The function was meant to rank houses for me and help decide which house to go for... well, my wife ended up choosing a different house than the one my program had picked. J.
Well, you can find another real-estate-savvy && MATLAB-savvy person here.
Which computer language did your wife use to program her decision maker? Anyway, I hope you decided to live in the same house as your wife.
I've used MATLAB to prank my coworkers. All of our powerful computers are connected so it's easy to modify anyone's mfiles.
A CSSM thread last year gave a creative and camouflaged way to rick roll someone, that's still the best.
http://www.mathworks.com/matlabcentral/newsreader/view_thread/294806
Could you provide a link? I searched "Sean de prank" with no luck.
To be honest, I didn't get it when I read it through, partially because I don't understand what is Rickrolling, partially because I can't view the video due to "This video contains content from SME. It is not available in your country". After a search, I got it and now I know what is called Rickrolling. http://en.wikipedia.org/wiki/Rickrolling. I love that song by the way.
I would love to be in that situation, poor coworkers, MATLAB is such a nice tool to mess with people, we just need to have good knowledge of the functions and be creative :) +1 vote
@Paulo: Do you ever have to write code for your coworkers? Such as they need a quick function, pass it off to you (token MATLAB nerd ( at least in my case)) and hide the gem in it when you send it to them.
Just think of all the fun that could be had by putting in a function passed on to co-workers the line:
fid = fopen('startup.m','at+')
and any ensuing calls to:
fprintf(fid,....)
In order from annoying to evil...
set(0,'defaultfigurecolor','red')
set(0,'defaultaxesxcolor','white')
set(0,'defaultaxescreat','delete(gca)') % !!
fprintf('Initializing, please wait...'),while 1,end % !!
fprintf('An error occured.'),pause(1),quit % Just plain wrong!
etc...
I am not sure of these pranks. I'll do it if I don't get caught. Did you get caught?
Impossible not to. My friend won: I was present when he was rickrolled and he played the whole song on the speakers in the lab.
@Sean, just saw your question, never had much fun pranking people with MATLAB but often the code I share goes with small errors on purpose, it's fun to see if someone can repair the problem or not.
I would love to rickroll someone with MATLAB, when I started programming it was with Borland C++ 3.1 (or some version similar, can't remember), my favorite thing was to generate sounds, like buzzing and beeping, many times the computer never stopped doing the sound even after my program was closed, it was very funny to see all the class and teacher annoyed with the sounds.
I used MATLAB to see how bad was the damage on my phone touch screen and to minimize the error, got the alignment values from the device and plotted them in a figure, it was really bad, I couldn't adjust the values and the touch screen had to be replaced.
That's cool Paulo! I would have no idea how to do that.
no big deal, I was working with the phone on my pocket and something sharp hit the screen, later at home I noticed that there was one huge offset on the position I pressed and the phone response.
It's one of those with windows mobile 6, there's one alignment tool that couldn't do the job (bad software) and the last way to change the alignment was to get/set the registry values, the values are points on the corners and center of the screen, so I plotted them with MATLAB to see the screen rectangle and have some idea what to change in order to reduce the offset (error on the position we press and the response), that saved me time because the device must be reboot after every change of the values.
When we were building our house I used the Virtual Reality Toolbox from within Simulink to "walk" through the 3D model given to us by the architect. Was much easier to navigate then his vrml-viewer ;-).
What format does the architect use? I have not had a chance to try the Virtual Reality Toolbox yet.
It is a VRML (Virtual Reality Modeling Language) file (extension .wrl).
I originally wrote this function: FEX: imcensor to censor beer cans out of pictures that might appear online.
nice one, +1 vote
I've suggested to use the Matlab installation CD as an animated hardward smiley: CSSM: 25-Oct-2009
nice one, +1 vote
I was struggling to identify the fault with an old regulated power supply - as I had no circuit diagram or service information.
I traced out the circuit from the PCB and recreated it in SimElectronics. I then used a real oscilloscope on the real PCB to compare against the signals within the model using the standard Simulink scope. Worked very well and essentially provided me with a 'gold standard' piece of hardware to compare my failed unit against!
This 'Parenting Toolbox' is a great idea. It reminds me that I've made my contributions. I wrote a program to help my kids on their math. It generates some random problems (addition, subtraction, multiplication or division with random numbers in a certain range) and asks for the answer. It is not that hard, right? Well, I added more features such as recording their sessions and tracking their progress. I compiled it into an executable so it can run on kids computer. It all worked but then Mom easily found a FREE website that can do all the above with fancy interface and great animation. It beat my program completely. That was a hard hit on my enthusiasm on Matlab.
Yes, but how long did it take them to develop the program?
I went through a very similar thing. I developed a MATLAB Kid's math helper that could generate arithmetical problems with 6 levels of difficulty, record and print to excel the scores and even track progress over sessions. My kids actually loved it, until they found one online that had dancing frogs and singing monkeys. It is hard to beat that with simple uicontrols...
Oh well, it was fun to develop and I learned a lot about GUI making when doing so.
Ha Ha, great minds think alike!
"Free" websites mean, that the creators do not have much money to protect their pages e.g. for cross-site-scripting. It is not a hard task to enable a webcam and the microphon remotely using such criminal tricks.
I know, it sounds paranoid. But it happens in reality. Therefore I'd trust your handmade program more than a free website.
Thank you for your concern, Jan. The website I mentioned is trusted. It is https://www.xtramath.org/home if you are interested.
Some criminals have prepared the websites of the German banks, e.g. Sparkasse und Postbank. They have been able to steal corresponding mTANs sent by SMS through a mobile phone. These pages used HTTPS also, but there been some corrupted certificates. Therefore I do trust all posters of this thread more than any website - even MATLAB-Answers (which tries to forward my IP to Google without asking me for confirmation)!
I'd rather want my money to be stolen, than movies of the kids published in the net - even if it shows them at learning maths only.
So if we create the Parenting Toolbox, I'm the best programmer for the implementation of the Paranoid-level and the Hysterical-blocks.
Really hard-to-believe and scary reality. Thanks for sharing!
I use Matlab to execute the C code in our microcontroller's C code.
How do you do this? Which microcontroller?
Contact us at files@mathworks.com
1 comment
Grzegorz Knor's unusual case is a good one, although I din't intend to accept an answer for this question but my finger slipped. Hope there will be more coming and I enjoyed every one's answer!