CSE 432 Spring 2019 Lab 7

April 1, 2019

Task 1

More symbolic algebra

%Lab 7 task 1
close all
clear
clc
syms x y;
y=x^2 + 5*x + 6;

fplot('x^3 + 5*x^2+9*x + 6', [-50 50])
figure
ezplot('1+cos(x)')
figure
ezpolar('x^3 + 5*x^2+9*x + 6')
figure
ezpolar('1+cos(x)')

Task 2

Laplace transform and Inverse Laplace transform in Matlab

%Lab 7 task 2 : Laplace and inverse laplace transform
close all
clear
clc
syms t a s;
y=exp(-a*t);
pretty(laplace(y))
y=exp(-3*t);
pretty(laplace(y))
y1=exp(3*t);
pretty(laplace(y1))

y2=3*exp(-2*t)-2*exp(-t);
pretty(laplace(y2))

y3=exp(-2*t)+exp(-t)*cos(3*t);
pretty(simplify(laplace(y3)))


y4=dirac(t);
pretty(simplify(laplace(y4)))

y5=heaviside(t);
pretty(simplify(laplace(y5)))


%inverse laplace
fs=(7*s-6)/(s^2-s-6);
pretty(ilaplace(fs))

Task 3

FFT in matlab

%Lab 7 task 3 : FFT
close all
clear
clc

f=50;
fs=100;
t=0:1/fs:10;
w=2*pi*f;
%y=cos(w*t);
%y=[zeros(1, length(t)/2) 1 zeros(1, length(t)/2)];
figure
plot(t,y);

f=(0:511)*fs/1024;
z=fft(y, 1024);
absz=abs(z(1:512));
%zz=fftshift(absz,512);
figure;
plot(f,absz)

%both sides

f=(-512:511)*fs/1024;
z=fft(y, 1024);
absz=abs(z(1:512));
abszz=[];
for i=1:512
    abszz(i)=absz(512-i+1);
end
 zz=[abszz absz];
%zz=abs(z)
figure;
plot(f,zz)

Homework
Find the laplace transform and inverse laplace transform of as many function of lecture 4

Print Friendly, PDF & Email

Leave a Reply