{"id":4532,"date":"2015-04-13T11:20:24","date_gmt":"2015-04-13T15:20:24","guid":{"rendered":"http:\/\/pages.vassar.edu\/magnes\/?p=4532"},"modified":"2015-04-15T10:36:36","modified_gmt":"2015-04-15T14:36:36","slug":"guitar-string-data-and-analysis-greg-and-teddy","status":"publish","type":"post","link":"https:\/\/pages.vassar.edu\/magnes\/2015\/04\/13\/guitar-string-data-and-analysis-greg-and-teddy\/","title":{"rendered":"Guitar String Data and Analysis (Greg and Teddy)"},"content":{"rendered":"<p>Here is the code for our modeled guitar string and the resulting force on the bridge. \u00a0This force oscillates with time, similar to the frequency of the sound waves that the instrument produces. \u00a0We were able to find the base and overtone\u00a0frequencies using the fast fourier transform function in MatLab, however our scaling is off for graphing purposes. \u00a0However, we know our data is correct because we plucked the string at a distance (B=1\/5) of the total length of the string which resulted in our fourier transform missing a 5th peak. \u00a0For future testing, we hope to record a physical string with similar variables to the one in our code, import the sound file to MatLab, analyze the frequencies, and compare it to the results of the modeled string.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2015\/04\/guitar-data.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4541\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2015\/04\/guitar-data.png\" alt=\"guitar data\" width=\"562\" height=\"419\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2015\/04\/guitar-data.png 562w, https:\/\/pages.vassar.edu\/magnes\/files\/2015\/04\/guitar-data-300x224.png 300w\" sizes=\"auto, (max-width: 562px) 100vw, 562px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Link to code:<\/p>\n<p><a title=\"Code\" href=\"https:\/\/docs.google.com\/document\/d\/1vNhrcuUVjmwfNM8raGKmyKAl0Z19bFR8c7rikb9tI1w\/edit?usp=sharing\">https:\/\/docs.google.com\/document\/d\/1vNhrcuUVjmwfNM8raGKmyKAl0Z19bFR8c7rikb9tI1w\/edit?usp=sharing<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>close all<br \/>\nclear all<br \/>\n%%%GUITAR STRING%%%<\/p>\n<p>%% Initialize Variables<br \/>\nL=.65; %Length of string (m)<br \/>\nT=149; %Tension of string (N)<br \/>\nc=320; %Velocity of wave (m\/s)<br \/>\ndx=.065; %Distance step<br \/>\ndt=0.00001015625; %time step (s)<br \/>\nr=1; %constant in oscillation calculation equation<br \/>\nAmp=.000005; %Amplitude of pluck (m)<br \/>\nLpluck=.13; %Length of pluck spot (m)<br \/>\nB=Lpluck\/L; %pluck position on string (m)<br \/>\nM=[0]; %Array for y vaules<br \/>\nruntime=1000;<\/p>\n<p>%% Builds initial pluck array<br \/>\nfor i=dx:dx:Lpluck<br \/>\ny=i*Amp\/Lpluck;<br \/>\nM=[M,y];<br \/>\nend<\/p>\n<p>for i=(Lpluck+dx):dx:L<br \/>\ny=(i-L)*(-Amp\/(L-Lpluck));<br \/>\nM=[M,y];<br \/>\nend<\/p>\n<p>%% Build X-aixs<br \/>\nx_axis=[];<\/p>\n<p>for i=0:dx:L<br \/>\nx_axis=[x_axis,i];<br \/>\nend<\/p>\n<p>%% Initialize Loop variables<\/p>\n<p>ynew=zeros(1,length(M));<br \/>\nycurrent=zeros(1,length(M));<br \/>\nyold=zeros(1,length(M));<br \/>\nycurrent=M;<br \/>\nyold=M;<\/p>\n<p>F=[];<br \/>\nN=[];<\/p>\n<p>%% Animation Loop (String Oscillations)<\/p>\n<p>for n=1:runtime<\/p>\n<p>for i=2:length(M)-1<br \/>\nynew(i)=2*(1-r^2)*ycurrent(i)-yold(i)+(r^2)*(ycurrent(i+1)+ycurrent(i-1));<br \/>\nend<\/p>\n<p>f=T*(ynew(2)-ynew(1))\/dx;<br \/>\nF=[F,f];<\/p>\n<p>N=[N,(n*dt)];<\/p>\n<p>yold=ycurrent;<br \/>\nycurrent=ynew;<\/p>\n<p>subplot(3,1,1)<br \/>\nplot(x_axis,ynew)<br \/>\naxis([0,0.7,-Amp*1.1,Amp*1.1])<br \/>\ntitle(&#8216;Waves on String with Initial Pluck&#8217;);<br \/>\nxlabel(&#8216;X displacement (m)&#8217;);<br \/>\nylabel(&#8216;Y displacement (m)&#8217;);<\/p>\n<p>subplot(3,1,2)<br \/>\nplot(N,F)<br \/>\naxis([0,runtime*dt,0,0.01])<br \/>\ntitle(&#8216;Force of String on Bridge&#8217;)<br \/>\nxlabel(&#8216;Time (s)&#8217;)<br \/>\nylabel(&#8216;Force (arbitrary units)&#8217;)<\/p>\n<p>pause(0.000001)<br \/>\nend<\/p>\n<p>%% Tension\/Frequency<\/p>\n<p>FFT=fft(F);<\/p>\n<p>FTscale=2^nextpow2(runtime);<br \/>\nf=dt\/2*linspace(0,1,FTscale\/2+1);<\/p>\n<p>subplot(3,1,3)<br \/>\nplot(f,(2*abs(FFT(1:FTscale\/2+1))))<br \/>\ntitle(&#8216;Internal Frequencies&#8217;)<br \/>\nxlabel(&#8216;Frequency (Hz)&#8217;)<br \/>\nylabel(&#8216;F(t)&#8217;)<\/p>\n<p>%need to fix scale on FT<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is the code for our modeled guitar string and the resulting force on the bridge. \u00a0This force oscillates with time, similar to the frequency of the sound waves that the instrument produces. \u00a0We were able to find the base and overtone\u00a0frequencies using the fast fourier transform function in MatLab, however our scaling is off [&hellip;]<\/p>\n","protected":false},"author":2594,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4532","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts\/4532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/users\/2594"}],"replies":[{"embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/comments?post=4532"}],"version-history":[{"count":3,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts\/4532\/revisions"}],"predecessor-version":[{"id":4594,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts\/4532\/revisions\/4594"}],"wp:attachment":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/media?parent=4532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/categories?post=4532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/tags?post=4532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}