{"id":10346,"date":"2026-07-31T16:29:54","date_gmt":"2026-07-31T20:29:54","guid":{"rendered":"https:\/\/blogs.mathworks.com\/community\/?p=10346"},"modified":"2026-07-31T16:29:54","modified_gmt":"2026-07-31T20:29:54","slug":"simulate-in-matlab-animate-in-blender","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2026\/07\/31\/simulate-in-matlab-animate-in-blender\/","title":{"rendered":"Simulate in MATLAB, Animate in Blender"},"content":{"rendered":"<p>Here's your challenge. You're controlling a sliding gantry crane that is supporting a heavy swinging load. You need to pilot that load safely over a fragile wall. Can you do it? How?<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"415\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/wall_clearance_challenge.png\" alt=\"\" class=\"alignnone size-full wp-image-10347\" \/><\/p>\n<p>I find this problem interesting because it's so dynamic and nonlinear. I can imagine how I would do it manually if I was driving the crane with a joystick. But I'm not sure how I would attack it as a MATLAB controls problem. In this post I work with Claude Code to create the scenario, solve the related controls problem, and then animate it using Blender. It was all remarkably straightforward.<\/p>\n<p>First I described the plant: gantry crane and pendulum. This is a four-state system where the input is the force driving the crane and the output is the x position of the pendulum bob. The initial challenge was to move the pendulum quickly from one position to another. Claude chose an LQR (Linear Quadratic Regulator) controller. I was happy with the result shown here.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"300\" height=\"247\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/crane_bob_control.gif\" alt=\"\" class=\"alignnone size-full wp-image-10352\" \/><\/p>\n<p>Let's add the constraint: the pendulum has to get over a high wall. Claude solved the problem in two steps. There's an aggressive thrust-brake maneuver to get the pendulum high enough to clear the wall, followed by a \"catch\" phase that can safely fall back to the linear assumptions of the LQR controller, bringing things to a graceful conclusion. This overall plan works in theory, but it resulted in a system that looked unrealistic. In the real world, the gantry crane would never be able to move that fast. <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"550\" height=\"247\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/crane_wall_clearance.gif\" alt=\"\" class=\"alignnone size-full wp-image-10353\" \/><\/p>\n<p>Now we move on to the next constraint: what's the least control input we can get away with? I asked Claude to use a resonant pump to boost the pendulum with as little control effort as possible. It then ran a tuning loop until the maximum actuator force was reduced by a factor of 20. Once over the wall, the LQR would catch the pendulum as before. Here is the result. First the data.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"475\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/resonant_pump_plot.png\" alt=\"\" class=\"alignnone size-full wp-image-10363\" \/><\/p>\n<p>Now for the animation.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"737\" height=\"247\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/crane_resonant_pump.gif\" alt=\"\" class=\"alignnone size-full wp-image-10354\" \/><\/p>\n<p>At this point, the technical problem has been solved. But if we really want to sell this idea, we need a better story. I wanted to try multi-modal storytelling with Claude driving both MATLAB and <a href=\"https:\/\/www.blender.org\/\">Blender<\/a>. It worked really well! Using the Blender's MCP connection, I could just say to Claude \"Take this simulation from MATLAB and use it to create a scene in Blender.\" It really was about that simple. <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"570\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/blender_scene.png\" alt=\"\" class=\"alignnone size-full wp-image-10366\" \/><\/p>\n<p>I made some improvements to the wall (make it a brick wall) and the gantry (add more detail). But it took very little work to get to this satisfying animation.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"711\" height=\"400\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/crane_swing.gif\" alt=\"\" class=\"alignnone size-full wp-image-10355\" \/><\/p>\n<p>The simulation is exactly the same, but we are able to heighten the drama of scenario. Before AI, it wouldn't have been worth my time to build a visualization like this. But it's so easy now that I couldn't resist. The combination of MATLAB's accuracy and control design with Blender's scene rendering is hard to beat.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/wall_clearance_challenge.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>Here's your challenge. You're controlling a sliding gantry crane that is supporting a heavy swinging load. You need to pilot that load safely over a fragile wall. Can you do it? How?<\/p>\n<p>I find this... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2026\/07\/31\/simulate-in-matlab-animate-in-blender\/\">read more >><\/a><\/p>\n","protected":false},"author":69,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/10346"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/users\/69"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=10346"}],"version-history":[{"count":15,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/10346\/revisions"}],"predecessor-version":[{"id":10370,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/10346\/revisions\/10370"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=10346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=10346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=10346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}