Applications of Differential and Difference Equations – MAT2002 Lab

Added on - 09 Nov 2020

  • 5

    pages

  • 807

    words

  • 5

    views

  • 0

    downloads

Showing pages 1 to 2 of 5 pages
APPLICATIONS OF DIFFERENTIALAND DIFFERENCE EQUATIONS –MAT2002LAB ASSIGNMENT – 05NAME: S. UDAY KIRANREGNO.: 18MIS0050FACULTY NAME: ARUNA.KSLOT: L47+L48EXPERIMENT – 5AZ-transforms and their applications for solvingDifference equationsQUESTION 1:Solve yn+2−4yn+1+ 3yn= n(2^n), n ≥ 0 y0 = 0, y1 = 0using Z-transform. Plot the solutionAIM:To find the solution of the difference equationusing the initial conditions given and Z-transformMATLAB CODE:clearallclcsymsn z y(n) YA=input('Enter y(n+2),y(n+1),y(n) coeff in vectorform');
f=input('Enter the non-homogeneous part f(x): ');cond=input('Enter the initial conditions in form[y(0),y(1)]: ')a=A(1);b=A(2);c=A(3);eqn=ztrans(a*y(n+2)+b*y(n+1)+c*y(n)-f)y0=cond(1);dy0=cond(2);eqn=subs(eqn,{str2sym('ztrans(y(n),n,z)'),str2sym('y(0)'),str2sym('y(1)')},{Y,y0,dy0});Y=solve(eqn,Y);y=simplify(iztrans(Y,z,n))m=0:10;disp('The solution of the differential equation : ')disp(y);y=subs(y,n,m)stem(y)INPUT:Enter y(n+2),y(n+1),y(n) coeff in vector form[1 -4 3]Enter the non-homogeneous part f(x):2*(2^n)Enter the initial conditions in form [y(0),y(1)]:[0 0]OUTPUT:The solution of the differential equation :3^n - 2*2^n + 1y =[ 0, 0, 2, 12, 50, 180, 602, 1932, 6050, 18660,57002]
desklib-logo
You’re reading a preview
card-image

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Download This Document