[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Does anyone know how I can animate a motional process (in this
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /sci/ - Science & Math

Thread replies: 14
Thread images: 3
File: Matlablogo.png (258 KB, 800x303) Image search: [Google]
Matlablogo.png
258 KB, 800x303
Does anyone know how I can animate a motional process (in this case gondola lift, modelled as double pendulum) with Matlab using the solution matrix of the ode solver and overlaying image files.

So far I have an animation using two line segments. This was relatively easy to do but now I'd like to replace those line segments with graphics of the system.
I made a vector graphic image of the system with inkscape but I think it should be easiest to convert the two bodies involved in the movement (mounting bar and cabin) into separate pngs and using my solution vector to position those images. The thing is, I have no idea how to do that.

Any ideas? (further pictures incoming)
>>
File: gondola.png (38 KB, 380x614) Image search: [Google]
gondola.png
38 KB, 380x614
here's a sketch of the system. That's what I draw in inkscape.
>>
>>8166862
didnt read your whole post, but when I want to animate something, I use imagesc( ) together with pause ( ).
>>
>>8166871
that looks promising. Thanks mate!
>>
>Using pleblab
>Not using Python and all its wonderous libraries
>>
>>8166950
no thanks I wanna finish my simulation today.
>>
>>8166862
OP.

You have your solution matrix. That allows you to solve for the equation of motion for the objects in your problem, right?

If you already have that information in hand, what I would suggest to do is solve this like how it's done in computer graphics:

1) Make a function that generates the geometry of a unit sized gondola, ie [X,Y,Z]=Gondola(); It takes no arguments, just returns back the bucket.

2) Calculate the position and orientation of your object (described by a vector and matrix respectively)

3) Transform the geometry by rotating first, then translate. (Since it's a unit sized bucket, you'll need to scale as the very first step before rotating!!)

4) Have a function that takes the gondola geometry and draws it with patches.

Does this help?


[X,Y,Z]=Gondola();
[T,R]=Solution2Pose(ODE SOLUTION GOES HERE);
A=R*[X';Y';Z']+T;
X=A(1,:); Y=A(2,:); Z=A(3,:);
DrawPatches(X,Y,Z);

Stick this in a loop and add drawnow() and you have yourself an animation.
>>
>>8166950
>python and all its wonderous libraries
its libraries are shit, the only good ones are numpy, pandas and maybe scipy. It can't do a fucking LDA without exploding your memory.
>>
File: TLP.png (141 KB, 320x320) Image search: [Google]
TLP.png
141 KB, 320x320
Anyone know where I can get MatLab for free without a torrent? I want to work on some code I am developing for my lab at my student housing but since I get internet from my university I can't, and wouldn't dare torrent it.
>>
>>8167791
this one its for mac and linux

http://www.descarga2.me/matlab-r2014b-x64-para-maclinux/
>>
>>8167806
Thanks I'll give it a try
>>
>>8167791
Octave is opensource Matlab. It's plotting sucks, but the language is a superset of Matlab.

Honestly though, if you don't have access to Matlab, that means you aren't at a University or College right now. If you don't HAVE to use Matlab, I STRONGLY discourage using it. It may have lots of toolboxes that make solving and visualizing a wide breadth of easy problems quickly, but the downsides are innumerable. The language is horrible. The consistency in the libraries is horrible. It fosters horrible programming skills. And as soon as you try to do anything non-trivial things quickly spiral out of control. For a language and environment that claims to value developer time, the upfront savings on time are repaid x10 when you need to do more complicated things. Vectorization is the bane of clear reasoning and readability.
>>
>>8167941
>The language is horrible. The consistency in the libraries is horrible. It fosters horrible programming skills. And as soon as you try to do anything non-trivial things quickly spiral out of control.
So much this. CS major here, I tried to learn Matlab and I would have rather mutilated myself with a rusty paperclip.
>>
>>8167863

enjoy your botnet, I hope you infect your whole campus :^)
Thread replies: 14
Thread images: 3

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.