Wel come to Hayat wali's website - About me



BASIC MATLAB OPERATIONSFOR MULTIPLICATION:*NO.OF COLUMNS = NO.OF ROWS a=[1 2 3]; (3 COLUMNS) b=[1 2 3;4 5 6;7 8 9]; (3 ROWS) c=a*bc = 30 36 42FOR ELEMENTS’ MULTIPLICATION:*SQUARE MATRIX = SQUARE MATRIX a=[4 2;2 4]; (2 ROWS=2 COLUMNS) b=[1 2;2 1]; (2 ROWS=2 COLUMNS) c=a*b c= 8 10 10 8FOR DIVISION:*NO.OF ROWS = NO.OF COLUMNS a=[1 2:2 1]; (2 ROWS) b=[1 2]; (2 COLUMNS) c= b\ac = 0 0 0 0.5000 1.0000 0.5000FOR ELEMENTS’ DIVISION: a=[1 2 4 7]; b=[2 4 7 5 ]; c=b\a c = 0 0 0 0 0 0 0 0 0.1429 0.2857 0.5714 1.0000 0 0 0 0c=a\bc = 0 0 0 0 0 0 0 0 0 0 0 0 0.2857 0.5714 1.0000 0.7143POWER OF ELEMENTS:a=[1 2 3 4]; b=(a.^2)b=1 4 9 16c=(a.^3)c=1 8 27 64d=(a.^4)d=1 16 81 256& So On…ADDITION, SUBTRACTION, MULTIPLICATION, DIVISION:a=[1 4 2 5];a+1ans =2 5 3 6a-1ans = 0 3 1 4a*1ans =1 4 2 5a/1ans =1 4 2 5a\1ans = 0 0 0 0.2000COLUMNS ADDITION: a=[2 4;5 6]; sum(a)ans = 7 10ROWS ADDITION:a=[2 4;5 6];sum(a,2)ans = 6 11ALL ELEMENTS ADDITION:a=[2 4;5 6];sum(sum(a))ans = 17INVERSE:a=[2 4;5 6]; inv(a)ans = -0.7500 0.5000 0.6250 -0.2500DETERMINATE:a=[2 4;5 6]; det(a)ans = -8MEAN:a=[2 4;5 6];mean(a)ans = 3.5000 5.0000STD:a=[2 4;5 6];std(a)ans = 2.1213 1.4142VARIATION:a=[2 4;5 6]; var(a)ans = 4.5000 2.0000FOR MAXIMUM ROW: a=[1 2 3 4;4 5 6 7;7 8 9 7]; max(a)ans = 7 8 9 7FOR MINIMUM ROW: a=[1 2 3 4;4 5 6 7;7 8 9 7]; min(a)ans = 1 2 3 4FOR MAXIMUM ELEMENT:a=[1 2 3 4;4 5 6 7;7 8 9 7];max(max(a))ans = 9FOR MINIMUM ELEMENT: a=[1 2 3 4;4 5 6 7;7 8 9 7]; min(min(a))ans = 1FOR SPECIFIC ROW:a=[1 4 7;2 5 8;1 4 7]; a(2,:)ans = 2 5 8FOR SPECIFIC COLUMN:a=[1 4 7;2 5 8;1 4 7];a(:,3)ans = 7 8 7FOR SPECIFIC ELEMENT: a=[1 4 7;2 5 8;1 4 7];a(2,3)ans = 8SIZE OF MATRIX: a=[1 2 4 7;4 5 8 7;4 1 4 4]; size(a) ans = 3 4SIZE OF ROWS:a=[1 2 4 7;4 5 8 7;4 1 4 4];size(a,1)ans = 3SIZE OF COLUMNS: a=[1 2 4 7;4 5 8 7;4 1 4 4]; size(a,2)ans = 4 ALL ZEROS WITH REFERENCE OF ANY MATRIX:a=[1 2 4 7;4 5 8 7;4 1 4 4];zeros(size(a))ans = 0 0 0 0 0 0 0 0 0 0 0 0REFRENCE ELEMENTS:a=[1 2 4 7;4 5 8 7;4 1 4 4];a(2:3,3:4)ans = 8 7 4 4PLOTING IN MATLABAsin(wt+ θ) (w=2πf)A=Amplitude (f=w/2π)w=Angular frequencyt=Timeθ=Phase Differencesx=[1 2 4 5 7];y=[4 7 8 5 8];plot(x,y)x=[1 2 4 5 7];y=[4 7 8 5 8];plot(y,x)t=[pi*(0:0.02:2)];y=sin(t);plot(y)t=[pi*(0:0.02:2)];y=sin(t+pi/2);plot(y)lefttopt=[pi*(0:0.02:2)];plot(t,sin(t))t=[pi*(0:0.02:2)];plot(t,cos(t))t=[pi*(0:0.02:2)];y=3*sin(3*t+0);plot(y)t=[pi*(0:0.02:2)];y=2*sin(6*t+pi);plot(y)t=[pi*(0:0.02:2)];y=2*cos(2*t+0);plot(y)t=[pi*(0:0.02:2)];plot(t,sin(t))t=[pi*(0:0.02:2)];plot(t,cos(t))t=[pi*(0:0.02:2)];plot(t,sinc(t))t=[pi*(0:0.02:2)];plot(t,exp(t))t=[pi*(0:0.02:10)];plot(t,sawtooth(t))x=[-5:0.0001:5];y=x.^2;plot(y)x=[-5:0.0001:5];y=x.^3;plot(y)x=linspace(-5,5);y=sinc(x);plot(x,y)PLOTINGWITH COLOURSt=[0:0.0001:2*pi];plot(t,sin(t),'k')plot(t,sin(t),'g')plot(t,sin(t),'b')plot(t,cos(t),'r')PLOTINGWITH DESIGNS & COLOURSx=[0:0.1:2*pi];plot(x,sin(x),'o-')lefttopplot(x,sin(x),'g+')plot(x,sin(x),'kO')plot(x,cos(x),'R^')plot(x,cos(x),'kd')plot(x,cos(x),'r+')DIFFERENT TYPES OF PLOTINGt=[0:0.001:1]’;plot([t t.^2 t.^3])t=[0:0.001:1]';plot([t,sin(t),cos(t)])t=[0:0.001:1]’;plot(t,[sin(t) cos(t)])x=0:0.001:2*pi;fill(x,sin(x),'g')fs=10000;t=0:1/fs:1/5;y=sawtooth(2*pi*5*t);plot(t,y)t=0:0.00001:10;y=sawtooth(2*pi*3*t*3);plot(t,y)t=0:0.00001:10;y=sawtooth(t,.5);plot(t,y)t=0:0.0001:100;rectpuls(t);plot(t,rectpuls(t))t=0:0.0001:100;plot(t,square(t))t=0:0.0001:100;y=square(t,80);fill(t,y,'r')t=0:0.0001:100;y=square(t,100);fill(t,y,'g')y=square(t,40);fill(t,y,'r')PLOTING WITH (Sine & Exponential)t=[0:0.01:2*pi];y=exp(sin(t));plotyy(t,y,t,y,'plot','stem')t=[0:0.1:2*pi];y=exp(sin(t));plotyy(t,y,t,y,'plot','stem')SUBPLOTTINGFor plotting many Figures in a single figurex=linspace(0,2*pi); (linspace is used for equal spacing b/w each number)subplot(2,2,1) (2Rows, 2columns & 1st fig)00.5100.20.40.60.81x=linspace(0,2*pi);subplot(3,3,1) (3Rows, 3columns & 1st fig)subplot(3,3,2) (3Rows, 3columns & 2st fig) subplot(3,3,3) (3Rows, 3columns & 3rd fig) subplot(3,3,4) (3Rows, 3columns & 4th fig) subplot(3,3,5) (3Rows, 3columns & 5th fig) (3,3,3)00.5100.51(3,3,1)00.5100.51(3,3,2)00.5100.51(3,3,4)00.5100.51(3,3,5)00.5100.51x=linspace(0,2*pi);subplot(3,3,1) (3Rows, 3columns & 1st fig)subplot(3,3,2) (3Rows, 3columns & 2st fig) subplot(3,3,3) (3Rows, 3columns & 3rd fig) subplot(3,3,4) (3Rows, 3columns & 4th fig) subplot(3,3,5) (3Rows, 3columns & 5th fig)plot(x,sin(x))x=[-10:0.01:10];plot(x,exp(x))grid on (grid on is used for lining in graph)hold on (hold on is used for holding a figure for all graphs)plot(x,exp(0.95*x))plot(x,exp(0.85*x))PLOTTING WITH COLOURS, TITLES, & LABELSx=[-10:0.01:10];plot(x,sin(x))hold ongrid onplot(x,sin(2*x),'r--')title('Multi sine plot') (‘title’ is used for assigning a Title)ylabel('y-axis') (‘ylabel’ is used for assigning Y-Label) xlabel('x-axis') (‘xlabel’ is used for assigning X-Label) legend('SinX','Sine2X') (‘legend’ is used for assigning separate notations for graphs)SEMI-LOG PLOTTINGx=[1000 10000 100000];y=[2 4 6];semilogx(x,y) lefttopx=[10000,10000];y=[1000,1000];loglog(x,y)AXIS DEFININGaxis([0 10 0 10]) (xlim 0 10; ylim 0 10)axis([0 4 0 1]) (xlim 0 4; ylim 0 1)axis([-10 10 0 10]) (xlim -10 10; ylim -10 10)PLOT TOOLSUTILITIES OF PLOT TOOLS:Used for plotting different figuresUsed for designing graph in many waysUsed for Title, X-label, Y-label & Legend as wellGiving 2D & 3D viewsChanging colorsGiving Text & many other tools can be used for plotting graphs3D PLOTTINGx=pi*(0:0.05:1);y=2*x;[X,Y]=meshgrid(x,y);plot(X(:),Y(:),'k.')plot(X(:),Y(:),'k.')surf(X,Y,sin(X^2))camlight leftlighting phongx=pi*(0:0.05:1);y=2*x;[X,Y]=meshgrid(x,y);plot(X(:),Y(:),'k.')surf(X,Y,sin(X.^2+Y))x=pi*(0:0.05:1);y=2*x;[X,Y]=meshgrid(x,y);plot(X(:),Y(:),'k.')surf(x,y,sin(X))x=pi*(0:0.05:1);y=2*x;[X,Y]=meshgrid(x,y);plot(X(:),Y(:),'k.')surf(x,y,cos(X.^2))[X,Y]=meshgrid(-8:0.5:8);R=sqrt(X.^2+Y.^2)+eps;Z=sin(R)./R;mesh(X,Y,Z)surf(X,Y,Z)colormap gray[X,Y]=meshgrid(-8:0.5:8);R=sqrt(X.^2+Y.^2)+eps;Z=sin(R)./R;mesh(X,Y,Z)surf(X,Y,Z)colormap hsv[X,Y]=meshgrid(-8:0.5:8);R=sqrt(X.^2+Y.^2)+eps;Z=sin(R)./R;mesh(X,Y,Z)surf(X,Y,Z)colormap copperx=[7 3 9 2 11 15 20 7 5 9];bar([0:length(x)-1],x)th=[0:0.0001:2*pi];rho=2*sin(th).*cos(th);polar(th,rho)x=rand([1 100]);hist(x,10);NUMERICAL ANALYSISsyms t f=@(t,y)2.*y-1f = @(t,y)2.*y-1ode45(f,[0,1],1)f=@(t,y)2.*y^2-1ode45(f,[0,1],1)f=@(t,y)2.*y^3-1;ode45(f,[-1,1],-1)f=@(t,y)2.*y-23;ode45(f,[0,1],1)f=@(t,y)2.*y-2;ode45(f,[0,1],1)f=@(t,y)2.*y-2;ode45(f,[-1,1],-1)f=@(t,y)2.*y-23;ode45(f,[-1,1],1)f=@(t,y)2.*y-3;ode45(f,[-1,1],1)DIFFERENTIATIONSingle Derivative:syms xg=sin(x);diff(g) d(g)/dx=d(sinx)/dx=Cosx ans = cos(x) diff(x) d(x)/dx=1 ans = 1Single Derivative: syms x g=sin(x); g=sin(x) diff(g,x) d(g)/dx=d(sinx)/dx=Cosx ans = cos(x) g=cos(x); diff(g,x) ans = -sin(x)Substitute Values (In Radian):syms xg=sin(x);diff(g,x) ans = cos(x) subs(ans,x,2.1) cosx=cos(2.1)ans = -0.5048Double Derivative:syms x g=sin(x); g=sin(x) diff(g,x,2) d’’(g)/dx=d”(sinx)/dx ans = -sin(x)Higher Order Derivatives: syms x diff(sin(x),x,1) (1 Represents for 1st Derivative) ans = cos(x) syms x diff(sin(x),x,2) (2 Represents for 2nd Derivative) ans = -sin(x) syms x diff(sin(x),x,3) (3 Represents for 3rd Derivative) ans = -cos(x) syms x diff(sin(x),x,4) (4 Represents for 4th Derivative) ans = sin(x)SUBSTITUTING VALUESThis is the shortcut command for substituting values in any function.Subs(diff(f(x)),x,?) syms x (‘syms’ is Short-cut for constructing symbolic objects.)syms xdiff(tan(x)) (Differentiate Tanx) ans = 1+tan(x)^2 subs(ans,x,2) (Putting x=2 in the answer) ans = 5.7744syms xsubs(diff(tan(x)),x,2) (Putting x=2 after differentiate Tanx)ans = 5.7744syms xsubs(diff(sin(x)),x,1) (Putting x=1 after differentiate Sinx)ans = 0.5403syms xsubs(diff(cos(x)),x,36) (Putting x=36 after differentiate Cosx)ans = 0.9918syms xdiff(tan(x^6-3*x+5)) (Differentiate Tan(x^6-3*x+5))ans = (1+tan(x^6-3*x+5)^2)*(6*x^5-3) subs(ans,x,3/2) (Putting x=3/2 in the answer)ans = 69.9149subs(diff(tan(x^6-3*x+5)),x,3/2) (Putting x=3/2 after differentiating Tan(x^6-3*x+5) ) ans = 69.9149INTEGERATION syms x int(sin(x),x) (Integrate sin(x) ) ans = -cos(x) syms x int(x*sin(x),x) (Integrate xsin(x)) ans = sin(x)-x*cos(x)DOUBLE INTEGERATION: double(int(sin(x^5+x^3),x,0,pi/2)) (Integrate sin(x^5+x^3) ) & (0-π/2) is limit ans = 0.2910 quad8(inline(sin(x^5+x^3)'),0,pi/2) (Integrate sin(x^5+x^3) ) & (0-π/2) is limit ans = 0.2910 quad8(inline(sin(x^5+x^3)'),0,pi/2) (Integrate sin(x^5+x^3) ) & (0-π/2) is limit ans = 0.2910RELATIONAL OPERATIONx=[1 2;2 3;5 6]x = 1 2 2 3 5 6x>2 (x>2 shows (1) the areas where x is greater than 2 otherwise 0)ans = 0 0 0 1 1 1x>1 (x>1 shows (1) the areas where x is greater than 1 otherwise 0)ans = 0 1 1 1 1 13>1 ans = 13<1ans = 03<=6ans = 13==4ans = 03<=3ans = 1POSITION/REFERENCE LOCATORCOLOUMN WISE x=[1 2;2 3;5 6]x = 1 2 2 3 5 6 x([2]) (Locating position at 2 in column)ans = 2 x([2 3 4]) (Locating position at 2,3,4 in column)ans = 2 5 2x(2) (Locating position at 2 in column)ans = 2x(3) (Locating position at 3 in column)ans = 5x(x>2) (Shows all values that are greater than 2)ans = 5 3 6x(x>1) (Shows all values that are greater than 1)ans = 2 5 2 3 6POLYNOMIAL EQUATIONSPolynomial equations are derived from word Poly means many.We are here to find out the slop of the equations.E.g.:( ax^3+bx^2+cx+d ) x=[1:2:20];y=[2:2:20];x=x';y=y';fit=polyfit(x,y,1)fit = 1.0000 1.0000plot(x,y,'o',x,fit(1)*x+fit(2))Finding Polynomial Equation by Roots:If roots are:x= +3x= -1We use the command POLY to converts the roots into polynomial.Manually: In MATLAB E.g.: (x-3)(x+1) a=[3;-1]x2 + x - 3x - 3= 0 poly(a)x2 -2x -3 = 0 ans = 1 -2 -3 x2 -2x -3 = 0Finding Roots by Polynomial Equation:If equation is: x2 -2x -3 = 0We use the command ROOTS to find out the roots of the equation: Manually: In MATLABx2-2x-3 = 0 p=[1 -2 -3];x2+x -3x-3 = 0 roots(p) (x-3)(x+1)=0 ans = x= +3 +3 x= -1 -1 OR roots([1 -2 -3]) ans = +3 -1Evaluate the Polynomial: If the Polynomial Equation is:F(x)=x3+6x-3=0F(x)=x3+0x2+6x-3=0Coefficients are [1 0 6 -3]Evaluating by x=2 v=[1 0 6 -3]; polyval(v,2) ans = 17Evaluating by x=3v=[1 0 6 -3];polyval(v,3)ans = 42 MATRICESManualIN MATLABA =[2 3;1 4]A = 2 3 1 4Inverse of A:A-1 =Adj A|A|Adj A = 4 -3 -1 2|A| = (4x2)-(-1x-3)|A| = 8-3|A| = 5A-1 = 4 -3-1 25A-1 = 0.8000 -0.6000 -0.2000 0.4000A=[2 3;1 4];A^-1ans = 0.8000 -0.6000 -0.2000 0.4000ManualIN MATLAB A=[2 3;1 4]A = 2 3 1 4 B=[9;3] B = 9 3 X =[X1;X2] X = X1 X2 AX=B X=A-1 B X = X1= 5.4000 X2= -0.6000A=[2 3;1 4]; B=[9;3]; X=A^-1*B X =5.4000-0.6000PROGRAMMING IN MATLABProgramming is defined as list of instructions.We create M-file for algorithm of any program.F5 is used as a shortcut key to run a program.Steps for writing & running a program:Click new & go to the M-file.Write algorithm of any program,Save it using Ctrl-S or by clicking save button after assigning file name.Go to the Matlab command window and type the file name. Example:Go to M-file & write program.clcx=0:0.0001:10save & file name E.g. (Sine1.m) Go to Matlab Command Window & type file name E.g. (Sine1).Assigning Comments:Go to M-file & write program.% (Write anything for comments).E.g.: % Hey how are you buddy?Save it by assigning any file name E.g. (buddy.m).Go to Matlab Command Window & type file name E.g. (help buddy).Function [x1, x2] =quadratic (a,b,c) [x1,x2] Output Arguments (a,b,c) Input Arguments Program 1: (Plotting Sine wave):Go to M-file & write algorithm of program.x=0:0.00001:10;y=sin(x);plot(x,y)Save it by assigning file name (a1.m).Go to the Matlab command window and type the file name (a1).Solution is:Program 2: (Quadratic Equation Solver): x=-b±b2-4ac2a We are going to solve a quadratic equation by quadratic formula algorithm. Go to M-file & write algorithm of program.function[x1,x2]=quadratic(a,b,c);a=2;b=3;c=4;d=sqrt(b^2-4*a*c);x1=(-b+d)/(2*a)x2=(-b-d)/(2*a)Save it by assigning file name (quadratic.m).Go to the Matlab command window and type the file name (quadratic).Solution is:x1 = -0.7500 + 1.1990i x2 = -0.7500 - 1.1990iProgram 3: (Displaying ‘a’ using “for-loop”):Go to M-file & write algorithm of program.a=1;for i=[1:10]; a=a+i; disp(a)endSave it by assigning file name (a3.m).Go to the Matlab command window and type the file name (a3).Solution is: a1 2 4 7 11 16 22 29 37 46 56Program 4: (Displaying ‘a’ using “for-loop”):Go to M-file & write algorithm of program.for i=1:10; a(i)=i*iendSave it by assigning file name (a4.m).Go to the Matlab command window and type the file name (a4).Solution is:a1a =1a =1 4a =1 4 9 a =1 4 9 16a =1 4 9 16 25a =1 4 9 16 25 36a =1 4 9 16 25 36 49a = 1 4 9 16 25 36 49 64a =1 4 9 16 25 36 49 64 81a =1 4 9 16 25 36 49 64 81 100Program 5: (Plotting sine wave using No. of cycles & frequency):Go to M-file & write algorithm of program.f=input('enter frequency');n=input('enter n.o of cycles');t=(0:0.0001:n/f);y=sin(2*pi*f*t);plot(t,y)Save it by assigning file name (a5.m).Go to the Matlab command window and type the file name (a5).Solution is: a1enter frequency3 (No. of Frequencies are 3)enter n.o of cycles3 (No. of Cycles are 3) Program 6: (Plotting sine & cosine waves using “while-loop” ):Go to M-file & write algorithm of program.x=0:0.1:10;while(1>0) a=menu('sine cosine',1,2,3,4,5); plot(x,sin(x)) if (a==2) plot(x,cos(x)) elseif(a==3) stem(x,sin(x)) elseif(a==4) stem(x,cos(x)) elseif(a==5) breakendendSave it by assigning file name (a6.m).Go to the Matlab command window and type the file name (a6).A table will appear (Sine Cosine) containing numbers from 1-5.Solution is:By pressing 1:By pressing 2:By pressing 3:lefttopBy pressing 4:By pressing 5: (Program ended)Program 7: (Displaying random numbers):Go to M-file & write algorithm of program.t=rand(1);if t>0.75; s=0elseif t<0.25; s=1else a=1-2*(t-0.25)endSave it by assigning file name (a7.m).Go to the Matlab command window and type the file name (a7).Program 8: (Displaying Tables of 1,2,3,4,5):Go to M-file & write algorithm of program.clcwhile(1>0)a=menu('table',1,2,3,4,5);if(a==1)for s=1:10z=1*s;disp('1X');disp(s);disp('=');disp(z);endendif(a==2)for s=1:10z=2*s;disp('2x');disp(s);disp('=');disp(z);endendif(a==3)for s=1:10z=3*s;disp('3x');disp(s);disp('=');disp(z);endendif(a==4)for s=1:10z=4*s;disp('4x');disp(s);disp('=');disp(z);endendif(a==5)breakendendSave it by assigning file name (a8.m).Go to the Matlab command window and type the file name (a8).SIGNALS & SYSTEMSUSING MATLABCREATING SIGNALS (IN DISCREATE TIME):Impulse function:x=[1:11];y=[1 zeros(1,10)];stem(x,y) Unit step function:x=[1:11];y=[ones(1,11)];stem(x,y)x=[1:10];y=[0,0 ones(1,8)];stem(x,y)Exponential function (Decaying):n=1:10;x=0.5.^n;stem(n,x)Exponential function (Increasing):n=0:10;x=2.^n;stem(n,x)CREATING SIGNALS (IN CONTINUOUS TIME):Unit step function:t=ones(1,100);plot(t)Exponential function (Increasing):t=1:0.001:10;y=exp(t);plot(t,y)Exponential function (Decaying):t=1:0.001:10;y=exp(-t);plot(t,y)CONVOLUTIONMethod #1(On command window)X[n] =0.5n u[n]H[n]=1 0≤n≤4Y[n]=?Input:n=0:10;x=0.5.^n;stem(n,x)Input x[n]01234567891000.10.20.30.40.50.60.70.80.91Impulse Response:h=ones(1,5);h=[h ones(1,5)];stem(h)Impulse Response h[n]123456789101100.20.40.60.811.21.41.61.82Convolution:y=conv(x,h);stem(y) Y[n] 0246810121416182000.20.40.60.811.21.41.61.82Method #2(By programming)LAPLACE TRANSFORMThe laplace transform of a signal x(t), X(t) →X(s)=-∞ ∞xte-st dtH(s) = T.F =OutputInputH(s) = T.F =S2-1S2+2S-3 S2-1 = 0 S2=1 S=± 1 S2+2S-3=0 S2+3S-S-3 = 0 S (S +3)-1(S +3) = 0 (S -1)( S +3) = 0 S=1;S=-3 IN MATLAB:For Equation: For Roots: o=[1 0 -1]; Z1=roots(o) i=[1 2 -3]; Z1 = 1 -1h=tf(o,i) P1=roots(i) Transfer function: P1 = -3 1 s^2 - 1-------------s^2 + 2 s - 3For plotting S-plane:o=[1 0 -1]; Output i=[1 2 -3]; Inputh=tf(o,i); Transfer functionZ1=roots(o); ZerosP1=roots(i); Polespzmap(Z1,P1) S-plane Map For plotting S-plane using Sgrid:o=[1 0 -1]; Output i=[1 2 -3]; Inputh=tf(o,i); Transfer functionZ1=roots(o); ZerosP1=roots(i); Polespzmap(Z1,P1) S-plane MapsgridFor viewing samples of audio file:a=wavread(‘file location',samples)E.g.: a=wavread('C:\WINDOWS\Media\tada',2000)MATLAB SOUND:t=0:1/8192:1;x=cos(2*pi*400*t);soundsc(x,8198)For Noise:t=0:1/8192:1;x=cos(2*pi*400*t);soundsc(x,8000)noise=randn(8192,1);soundsc(noise,8000)SIMULINKX(t)=Acos(wt+θ) A → Gain Cos → Trigonometric function W → Frequency T → Time θ → Phase differencedxdy=(-2x+1) dxdx=-2x+1dxX=-2x22+x+cX=-x2+x+cX(k)=e(k-3)+2.2x(k-1)-1.57x(k-2)+0.3x(k-3)For 0≤k≤8 ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download