matlab printout full.pdf
DESCRIPTION
matlab programsTRANSCRIPT
Generate the following signals (assume f) and plot their frequency spectrum using DFT commands.
a) Square function b) Sine function c) Ramp function
Find the impulse response of a LTI system for given difference equationy(n) - y(n-1) + 0.9y(n+2) = x(n)
% Program to evaluate quadtratic equation:
clc; clear all; close all; a=input('Enter the value of a='); b=input('enter the value of b='); c=input('enter the value of c='); x(1)=(-b+sqrt(b*b-4*a*c))/(2*a); x(2)=(-b-sqrt(b*b-4*a*c))/(2*a); disp('The roots of quadratic equations are'); disp('x(1)='); disp(x(1)); disp('x(2)='); disp(x(2));
Result: Enter the value of a=4 Enter the value of b=6 Enter the value of c=2 The roots of quadratic equations are x(1)= -0.5000 x(2)= -1
%Program to calculate the trigonometric quantities: clc; clear all; close all; deg=input('Enter the value of theta in degree='); rad=deg*pi/180; cal_1=sin(rad/6); disp('The value of sin(deg/6) is ='); disp(cal_1); cal_2=cos(rad); disp('The value of cos(deg) is ='); disp(cal_2); cal_3=tan(rad/2); disp('The value of tan(deg/2) is ='); disp(cal_3); cal_4=[(sin(rad/6))^2+(cos(rad/6))^2]; disp('The value of (sin(rad/6))^2=(cos(rad/6))^2 is ='); disp(cal_4);
Result: Enter the value of theta in degree=60 The value of sin(deg/6) is = 0.1736 The value of cos(deg) is = 0.5000 The value of tan(deg/2) is = 0.5774 The value of (sin(rad/6))^2=(cos(rad/6))^2 is = 1.0000
Generate two sinusoids & compute their product. plot them in time & frequency domain (Fourier transform)