{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 1: Fundamental of vibration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.4_2: sum_of_two_harmonic_motion.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "mprintf('Mechanical vibrations by G.K.Grover\n Example 1.4.2\n')\n", "//given data\n", "//case 1\n", "//x1=(1/2)*cos((%pi/2)*t)...x1=a*cos(W1*t)\n", "//x2=sin(%pi*t)...x2=b*sin(W2*t)\n", "//calculations\n", "W1=(%pi/2)\n", "W2=%pi\n", "t1=2*%pi/(W1)\n", "t2=2*%pi/(W2)\n", "p1=[t1 t2]\n", "T1=lcm(p1)\n", "//case 2\n", "//x1=2*cos((%pi*t)...x1=a*cos(W3*t)\n", "//x2=2*cos(2*t)...x2=a*cos(W4*t)\n", "W3=%pi\n", "W4=2\n", "t3=2*%pi/(W3)\n", "t4=2*%pi/(W4)\n", "p2=[t3 t4]\n", "T2=lcm(p2)\n", "//output\n", "mprintf('Case(i)\nTime period of first wave is %f sec\nTime period of first wave is %f sec\nThe time period of combined wave is %f sec\nCase(ii)\nTime period of first wave is %f sec\nTime period of first wave is %f sec\nThe time period of combined wave is %f sec',t1,t2,T1,t3,t4,T2)\n", "mprintf('\nNOTE: The time period of combined motion in case (ii) cannot be calculated\n since pi is a non-terminating and non recurring number.\n But SCILAB takes the value of pi to be 3.141593 and therefore\n calculates the LCM of pi and the time period of first wave in case (ii.')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.5_1: max_and_min_amplitude_of_combined_motion.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "mprintf('Mechanical vibrations by G.K.Grover\n Example 1.5.1\n')\n", "//given data\n", "//x1=a*sin(W1*t)\n", "//x2=b*sin(W2*t)\n", "//calculations\n", "a=1.90//amplitude of first wave in cm\n", "b=2.00//amplitude of second wave in cm\n", "W1=9.5//frequency of first wave in rad/sec\n", "W2=10.0//frequency of second wave in rad/sec\n", "xmax=b+a//maximum amplitude of motion in cms\n", "xmin=abs(a-b)//minimum amplitude of motion in cms\n", "f=abs(W1-W2)/(2*%pi)//beat frequency in Hz\n", "t=1/f//time period of beat in sec\n", "//output\n", "mprintf('The maximum amplitude of motion is %4.4f cms\nThe minimum amplitude of motion is %4.4f cms\n The beat frequency is %4.4f Hz\n the time period is %4.4f sec',xmax,xmin,f,t)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.6_1: complex_number_in_exponential_form.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "mprintf('Mechanical vibrations by G.K.Grover\n Example 1.6.1\n')\n", "//given data\n", "//case 1\n", "//a complex number is represented as Z=X+j*Y where j is imaginary\n", "//V=3 +j*7\n", "x1=3\n", "y1=7\n", "//calculations\n", "r1=sqrt(x1^2+y1^2)\n", " if (y1/x1)>0 then theta1=atan(y1/x1)\n", " else theta1=%pi-atan(abs(y1/x1))\n", " end\n", "theta1=atan(y1/x1)\n", "//case 2\n", "//V=-5 +j*4\n", "x2=-5\n", "y2=4\n", "//calculations\n", "r2=sqrt(x2^2+y2^2)\n", " if (y2/x2)>0 then theta1=atan(y2/x2)\n", " else theta2=%pi-atan(abs(y2/x2))\n", " end\n", "//output\n", "mprintf('case(i) V=3+j*7 is represented as V=%3.3f*e^(j*(%3.3f))\ncase(ii) V=-5+j*4 is represented as V=%3.3f*e^(j*(%3.3f))',r1,theta1,r2,theta2)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.6_2: complex_number_in_rectangular_form.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "mprintf('Mechanical vibrations by G.K.Grover\n Example 1.6.2\n')\n", "//given data\n", "//Z=r*e^(i*theta) is represented as Z=r*cos(theta) + i*r*sin(theta)= x +i*y\n", "//where r*cos(theta)=x and r*sin(theta)=y\n", "//case 1\n", "//V=5*e^(j*0.10)\n", "r1=5\n", "theta1=0.1\n", "x1=r1*cos(theta1)\n", "y1=r1*sin(theta1)\n", "v1=complex(x1,y1)\n", "//case 2\n", "//V=17*e^(-j*3.74)\n", "r2=17\n", "theta2=-3.74\n", "x2=r2*cos(theta2)\n", "y2=r2*sin(theta2)\n", "v2=complex(x2,y2)\n", "//output\n", "mprintf('case(i):V=5*e^(j*0.10) is represented as')\n", "disp(v1)\n", "mprintf('\ncase(ii):V=17*e^(-j*3.74) is represented as')\n", "disp(v2)\n", "mprintf('\nNOTE:complex number is represented as x+y*i in SCILAB')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.7_1: work_done_by_a_force_on_displacement.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "mprintf('Mechanical vibrations by G.K.Grover\n Example 1.7.1\n')\n", "//given data\n", "Po=25//amplitude of force in N\n", "Xo=0.05//ampliyude of displacement in m\n", "W=20*%pi\n", "//calculations\n", "//case 1\n", "t0=0\n", "t1=1\n", "v1=integrate('sin(W*t)*cos(W*t-%pi/6)','t',t0,t1)\n", "WD1=Po*Xo*W*v1\n", "//case 2\n", "t0=0\n", "t1=1/40\n", "v2=integrate('sin(W*t)*cos(W*t-%pi/6)','t',t0,t1)\n", "WD2=Po*Xo*W*v2\n", "//output\n", "mprintf(' (i)work done during the first second is %f N-m\n (ii)work done during the first 1/40th of second is %f N-m',WD1,WD2)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.8_2: fourier_components_of_periodic_motion.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "clear\n", "mprintf('Mechanical vibrations by G.K.Grover\n Example 1.8.2\n')\n", "//given data\n", "T=0.1//time period of periodic motion in sec\n", "W=2*%pi/T\n", "k=12/2//number of elements in half cycle\n", "mprintf('\tNo of elements in one cycle 2k=12,t(j) in degrees\n')\n", "mprintf('t(j) f(j) cos(t(j)) f(j)*cos(t(j)) sin(t(j)) f(j)*sin(t(j) cos(2*t(j)) f(j)*cos(2*t(j)) sin(2*t(j)) f(j)*sin(2*t(j)) cos(3*t(j)) f(j)*cos(3*t(j) sin(3*t(j)) f(j)*sin(3*t(j)\n')\n", "f(1)=10/6\n", "for j=1:6\n", " t(j)=j*(%pi/k)\n", " m(j)=cos(t(j))\n", " n(j)=f(j)*m(j)\n", " o(j)=sin(t(j))\n", " p(j)=f(j)*o(j)\n", " q(j)=cos(2*t(j))\n", " r(j)=f(j)*q(j)\n", " s(j)=sin(2*t(j))\n", " u(j)=f(j)*s(j)\n", " v(j)=cos(3*t(j))\n", " x(j)=f(j)*v(j)\n", " y(j)=sin(3*t(j))\n", " z(j)=f(j)*y(j)\n", " f(j+1)=f(j)+f(1)\n", "mprintf('%3.0f\t',t(j)*(180/%pi))\n", "mprintf('%3.4f\t\t',f(j))\n", "mprintf('%3.4f\t\t',m(j))\n", "mprintf('%3.4f\t\t',n(j))\n", "mprintf('%3.4f\t\t',o(j))\n", "mprintf('%3.4f\t\t',p(j))\n", "mprintf('%3.4f\t\t',q(j))\n", "mprintf('%3.4f\t\t',r(j))\n", "mprintf('%3.4f\t\t',s(j))\n", "mprintf('%3.4f\t\t',u(j))\n", "mprintf('%3.4f\t\t',v(j))\n", "mprintf('%3.4f\t\t',x(j))\n", "mprintf('%3.4f\t\t',y(j))\n", "mprintf('%3.4f\n',z(j))\n", "end\n", "f(7)=f(j)-f(1)\n", "for j=7:12\n", " t(j)=j*(%pi/k)\n", " m(j)=cos(t(j))\n", " n(j)=f(j)*m(j)\n", " o(j)=sin(t(j))\n", " p(j)=f(j)*o(j)\n", " q(j)=cos(2*t(j))\n", " r(j)=f(j)*q(j)\n", " s(j)=sin(2*t(j))\n", " u(j)=f(j)*s(j)\n", " v(j)=cos(3*t(j))\n", " x(j)=f(j)*v(j)\n", " y(j)=sin(3*t(j))\n", " z(j)=f(j)*y(j)\n", " f(j+1)=f(j)-f(1)\n", " mprintf('%3.0f\t',t(j)*(180/%pi))\n", "mprintf('%3.4f\t\t',f(j))\n", "mprintf('%3.4f\t\t',m(j))\n", "mprintf('%3.4f\t\t',n(j))\n", "mprintf('%3.4f\t\t',o(j))\n", "mprintf('%3.4f\t\t',p(j))\n", "mprintf('%3.4f\t\t',q(j))\n", "mprintf('%3.4f\t\t',r(j))\n", "mprintf('%3.4f\t\t',s(j))\n", "mprintf('%3.4f\t\t',u(j))\n", "mprintf('%3.4f\t\t',v(j))\n", "mprintf('%3.4f\t\t',x(j))\n", "mprintf('%3.4f\t\t',y(j))\n", "mprintf('%3.4f\n',z(j))\n", "end\n", "sumf(j)=f(1)+f(2)+f(3)+f(4)+f(5)+f(6)+f(7)+f(8)+f(9)+f(10)+f(11)+f(12)\n", "sumcos(t(j))=m(1)+m(2)+m(3)+m(4)+m(5)+m(6)+m(7)+m(8)+m(9)+m(10)+m(11)+m(12)\n", "sumfjcos(t(j))=n(1)+n(2)+n(3)+n(4)+n(5)+n(6)+n(7)+n(8)+n(9)+n(10)+n(11)+n(12)\n", "sumsin(t(j))=o(1)+o(2)+o(3)+o(4)+o(5)+o(6)+o(7)+o(8)+o(9)+o(10)+o(11)+o(12)\n", "sumfjsin(t(j))=p(1)+p(2)+p(3)+p(4)+p(5)+p(6)+p(7)+p(8)+p(9)+p(10)+p(11)+p(12)\n", "sumcos2(t(j))=q(1)+q(2)+q(3)+q(4)+q(5)+q(6)+q(7)+q(8)+q(9)+q(10)+q(11)+q(12)\n", "sumfjcos2(t(j))=r(1)+r(2)+r(3)+r(4)+r(5)+r(6)+r(7)+r(8)+r(9)+r(10)+r(11)+r(12)\n", "sumsin2(t(j))=s(1)+s(2)+s(3)+s(4)+s(5)+s(6)+s(7)+s(8)+s(9)+s(10)+s(11)+s(12)\n", "sumfjsin2(t(j))=u(1)+u(2)+u(3)+u(4)+u(5)+u(6)+u(7)+u(8)+u(9)+u(10)+u(11)+u(12)\n", "sumcos3(t(j))=v(1)+v(2)+v(3)+v(4)+v(5)+v(6)+v(7)+v(8)+v(9)+v(10)+v(11)+v(12)\n", "sumfjcos3(t(j))=x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7)+x(8)+x(9)+x(10)+x(11)+x(12)\n", "sumsin3(t(j))=y(1)+y(2)+y(3)+y(4)+y(5)+y(6)+y(7)+y(8)+y(9)+y(10)+y(11)+y(12)\n", "sumfjsin3(t(j))=z(1)+z(2)+z(3)+z(4)+z(5)+z(6)+z(7)+z(8)+z(9)+z(10)+z(11)+z(12)\n", "a0=sumf(j)/(2*k)\n", "a1=sumfjcos(t(j))/k\n", "b1=sumfjsin(t(j))/k\n", "a2=sumfjcos2(t(j))/k\n", "b2=sumfjsin2(t(j))/k\n", "a3=sumfjcos3(t(j))/k\n", "b3=sumfjsin3(t(j))/k\n", "disp('The fourier components of periodic motion shown in example 1.8.1 are as follows')\n", "mprintf('\nao=%f\na1=%f\nb1=%f\na2=%f\nb2=%f\na3=%f\nb3=%f\n',a0,a1,b1,a2,b2,a3,b3)" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }