## Loren on the Art of MATLABTurn ideas into MATLAB

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# Is This a Sine Wave?5

Posted by Loren Shure,

I was talking with Mike, my boss, one afternoon. And we had been fiddling with some paper as we spoke. After trimming a page, we ended up with a not skinny strip of stiff paper. As Mike twisted it, we wondered if the envelope we could see was a sine wave.

### Get the Data into MATLAB

First thing, take picture to load into MATLAB.

imshow sinWave.png


Next do an eyeball experiment. I select a section of the twisted paper. And overlay a sine wave, with guessed amplitude.

hold on
axis on
x = [244 329];
y = [170 170];
del = diff(x);
nsteps = 100;
xx = x(1):del/nsteps:x(2);
lenxm1 = length(xx)-1;
scale = 4.0;
yy1 = y(1)+scale*sin((0:lenxm1)/lenxm1*pi);
yy2 = y(1)-scale*sin((0:lenxm1)/lenxm1*pi);
plot(xx,yy1,'m',xx,yy2,'m')
hold off
axis off


Problem is, I don't know what the scale factor should be. I can try some values out. By changing the code and re-running the section. OR I can take advantage of one of the new features available in Live Scripts, a Numerical Slider control. I can find this in the Insert Gallery of the MATLAB Toolstrip.

So let's start again and see what this would look like.

imshow sinWave.png
hold on
x = [244 329];
y = [170 170];
del = diff(x);
nsteps = 100;
xx = x(1):del/nsteps:x(2);
lenxm1 = length(xx)-1;
scale = 7.5

scale =
7.5

yy1 = y(1)+scale*sin((0:lenxm1)/lenxm1*pi);
yy2 = y(1)-scale*sin((0:lenxm1)/lenxm1*pi);
plot(xx,yy1,'m',xx,yy2,'m')
hold off


When you try the interactive controls in the Live Editor, you will see that the section reruns after the control is updated. A nice way to explore the consequences of specific parameter choices for your work!

Next let's see a zoomed in view.

axis([220, 350, 150 190])


Of course we could zoom interactively but since I don't feel like creating a video, I am doing it programmaticaIly instead. You can use the interactive zoom tools for plots in the Live Editor if you prefer.

My exploration by plotting doesn't prove anything, but I do think it's suggestive that a sine wave is at least a good candidate for the envelope of the twisted strip.

By the way, this is a picture of the Live Editor code with the slider in it.

### Have You Been Using the Live Editor, and its Newest Additions?

I have found that the interactive tools in the Live Editor make parts of my exploratory work much more efficient and satisfying. What have you been able to do more easily with the Live Editor? Let me know here.

## 5 CommentsOldest to Newest

John D'Errico replied on : 1 of 5

Hi Loren,

This reminds me of the reverse spaghetti problem. Something simple to visualize, and even perform some basic tests to understand the behavior. Spaghetti tastes better of course.

http://appliedmechanics.asmedigitalcollection.asme.org/article.aspx?articleid=1408780

https://link.springer.com/article/10.1023/B:MUBO.0000025392.77757.26

http://vibrationacoustics.asmedigitalcollection.asme.org/article.aspx?articleid=1469159

Assume that the length of the strip is sufficiently long that in the mid-section, any edge effects due to how I am holding the ends have dissipated. I would argue that the sheet, across the width of the web is under some compression, but not that much that wrinkles will develop in the paper. I would argue that the twist is not sufficiently large that the paper has folded. So the behavior of this strip will live in a rather simple domain. Too large tension or too much of a twist will cause buckling in some form.

Next, I would think about the shape of the web across its width at any point along the length. Will there be significant out of plane deformation? Here I’ll argue that symmetry considerations won’t allow it, as long as the tension and twist are reasonably small. There may be some amount of in-plane strains in the web, but I will argue that at any point, if we ignore the twist angle, the shape of the web is a straight line across the web. You can even see that from the picture. As well, as long as we look near the central section, the width of the paper web will be essentially constant along the length. This is paper. If there were any significant strains in the paper, then it would tear at some point. So, at any point along the length of the twisted paper web, we can view a cross section as a rotated line segment of fixed size.

How about the twist per unit length? Again, I’ll make simple physical arguments to suggest that if the twist was not essentially constant in the mid-section, then the forces on some sections of the paper will not be balanced, so the system will not be in a state of minimal potential energy.

So we can argue that the envelope we see is that of a rotated line segment, of constant length. The rotation per unit distance along the web will be uniform. You can probably see where I am going. The fundamental perceived shape (the envelope) will indeed be a sine wave, possibly impacted by edge effects near the ends. This will hold as long as you don’t pull so much on the ends that wrinkles or folds develop, as long as you don’t twist it so severely as to cause similar problems.

The period of the sine wave will depend on the number of twists performed. This all depends on the relative width versus length of the strip. Were you to try a similar experiment with a 8 1/12 x11 sheet of paper, my arguments would clearly fail. Any significant twisting would then quickly cause wrinkles and folds, difficult to model nonlinear buckling behavior. Inhomogeneity of paper parameters along the length and width of the web would cause serious problems of course.

The perceived amplitude of the sine wave will depend on the original width of the strip, and the distance to it from your eyes.

Serious attempts at modeling beyond the simple arguments I’ve made here would be interesting, probably worth a paper in some journal. (Anything is worth a paper, especially if it discusses wrinkling, or at least the possibilities thereof.) I’d also want to do some measurements and experimentation to back up the claims I’ve made. It has been a while since I looked at problems like this, and I’d not be surprised if that paper has already been published by someone.

Loren Shure replied on : 2 of 5

Thanks, John. Great analysis!

Oleksandr Slovak replied on : 3 of 5

>> Live Editor make parts of my exploratory work much more efficient and satisfying

Ok, and what about collaboration?
How to merge changes in two live documents made by two developers using git?
For me, using protected binary format for the document is a crime against collaborative development.

David Garrison replied on : 4 of 5

MATLAB has integration with git and subversion (R2014b). in R2018a, it is possible to use the File Comparison tool to diff two live scripts. Live script merge is coming in R2018b (prerelease on 6/14/2018).