{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 18: Fourier Circuit Analysis" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 18.1: Trigonometric_form_of_the_Fourier_Series.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clear\n", "close\n", "clc\n", "//Example 18.1\n", "//From the figure 18.2\n", "disp('The equation of v(t) considering one period can be written as')\n", "disp('v(t)=Vm*cos(5*%pi*t) for -0.1<=t<=0.1')\n", "disp('v(t)=0 for 0.1<=t<=0.3')\n", "//Assuming the value of Vm is 1\n", "Vm=1;\n", "//Evaluating the constants an and bn\n", "//bn=0 for all n\n", "//an=(2*Vm*cos(n*%pi/2))/(%pi*(1-n^2))\n", "//a0=Vm/%pi\n", "t=-1:0.02:1\n", "v0t=Vm/%pi\n", "v1t=(1/2)*(Vm*cos(5*%pi*t))\n", "v0t_v1t=v0t+v1t\n", "v2t=(2/(3*%pi))*(Vm*cos(10*%pi*t))\n", "v0t_v1t_v2t=v0t+v1t+v2t\n", "v3t=(2/(15*%pi))*(Vm*cos(20*%pi*t))\n", "v0t_v1t_v2t_v3t=v0t+v1t+v2t-v3t\n", "figure\n", "a = gca ();\n", "a. y_location = 'origin';\n", "a. x_location = 'origin';\n", "a. data_bounds =[ -1,0;1 0.5];\n", "plot (t,v0t)\n", "xtitle('vot vs t','t in s','vot')\n", "figure\n", "a = gca ();\n", "a. y_location = 'origin';\n", "a. x_location = 'origin';\n", "a. data_bounds =[ -1,-0.5;1 0.5];\n", "plot (t,v0t_v1t)\n", "a. y_location = 'origin';\n", "a. x_location = 'origin';\n", "a. data_bounds =[ -1,-0.5;1 0.5];\n", "plot (t,v0t_v1t_v2t,'r.->')\n", "a. y_location = 'origin';\n", "a. x_location = 'origin';\n", "a. data_bounds =[ -1,-0.5;1 0.5];\n", "plot (t,v0t_v1t_v2t_v3t,'d')\n", "xtitle('v(t)','t in s','v(t) in V')" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 18.5: Definition_of_the_Fourier_Transform.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc;\n", "//Example 18.5\n", "//Let amplitude be 1 \n", "A=1;\n", "Dt=0.01;\n", "T1=4;\n", "t=0:Dt:T1/4;\n", "for i=1:length(t)\n", " xt(i)=A\n", "end\n", "//Calculate Fourier Transform\n", "Wmax=2*%pi*1;\n", "K=4;\n", "k=-(2*K):(K/1000):(2*K);\n", "W=k*Wmax/K;\n", "xt=xt';\n", "XW=xt*exp(-sqrt(-1)*t'*W)*Dt;\n", "XW_Mag=real(XW);\n", "W=[-mtlb_fliplr(W),W(2:1001)];\n", "XW_Mag=[mtlb_fliplr(XW_Mag),XW_Mag(2:1001)];\n", "subplot(2,1,1);\n", "a=gca();\n", "a.data_bounds=[0,0;1,1.5];\n", "a.y_location='origin';\n", "plot(t,xt);\n", "xlabel('t in sec.');\n", "title('v(t)vs t');\n", "subplot(2,1,2);\n", "a=gca();\n", "a.y_location='origin';\n", "plot(W*%pi/2,abs (XW_Mag));\n", "xlabel('Freq in rad/sec');\n", "ylabel('|F(jw)|')\n", "title('|F(jw)| vs t');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 18.6: Physical_significance_of_Fourier_Transform.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clc\n", "syms s t\n", "printf('Given')\n", "disp('v(t)=4*exp(-3*t)*u(t)')\n", "v=4*exp(-3*t)\n", "\n", "F=4*(integ(exp(-(3+%i*1)*s),s,0,%inf))\n", "//The secind term tends to zero\n", "disp(F,'F=')\n", "//Let W be the total 1 ohm energy in the input signal\n", "W=integ(v^2,t,0,%inf)\n", "disp(W,'W=')\n", "//Let Wo be the total energy\n", "//As the frequency range is given as 1 Hz<|f|<2 Hz\n", "//Considering symmetry\n", "Wo=(1/%pi)*integ((16/(9+s^2)),s,2*%pi,4*%pi)\n", "disp(Wo,'Wo=')\n", "\n", "\n", "" ] } ], "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 }