Tuesday, October 8, 2024
HomeMatlabComputing π… Simscape Multibody Type » Man on Simulink

Computing π… Simscape Multibody Type » Man on Simulink


On this π day 2024, I made a decision to tag together with Mike Croucher from The MATLAB Weblog and present one option to compute π.

The Mannequin

I used Movement Actuation to roll the cylinder by 360 levels and sensed by how a lot it had translated. I used to be then capable of compute π utilizing:

π=d2r

the place d is the gap travelled and r is the radius of the cylinder.

in = Simulink.SimulationInput(mdl);

r = 1; % Cylinder radius;

d = out.yout{1}.Values.Knowledge(finish); % last distance

As a result of the cylinder slipped a bit on the bottom, I didn’t get a really correct consequence, however it’s in all probability consultant of the consequence you’ll get for those who had tried computing π that manner a number of thousand years in the past.

Now it is your flip

Hopefully, you could find extra correct methods to compute π.

If you should mannequin cylinders rolling on the bottom, strive opening the mannequin used for this weblog publish in MATLAB On-line by clicking on this banner:



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments