CSE 432 Fall 2019 Lab 7

November 15, 2019

Task 1

More Symbolic Algebra

%Lab 7 Task 1

close all;
clear;
clc;

syms x y;
%y=x^2+5*x+6;
figure
fplot('x^2+5*x+6',[-50 50])
figure
ezpolar('cos(x)')
figure
ezpolar('2+cos(x)')
figure
ezpolar('sin(x)+cos(x)')
figure
ezplot('cos(x)')

Task 2

Laplace Transform and Inverse Laplace Transform

%Lab 7 Task 2

close all;
clear;
clc;

syms t a s;
y=exp(-a*t);
pretty(laplace(y))

y1=exp(3*t);
pretty(laplace(y1))

pretty(laplace(heaviside(t)))

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

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

Task 3

FFT in MATLAB

%Lab 7 Task 3
%Fourier Transform using FFT

close all;
clear;
clc;

f=100;
fs=10*f;
t=0:1/fs:1;
y=cos(2*pi*f*t);
figure 
plot(t,y)

%NFFT = 2^nextpow2(length(t));
NFFT=1024;
z=fft(y,NFFT);
z=z(1:length(t)/2 +1);

freq=0:length(t)/2;
freq=freq*fs/NFFT;
figure
plot(freq,abs(z))

%Lab 7 Task 3_1 
%Fourier Transform using FFT for a different function

close all;
clear;
clc;

f=100;
fs=10*f;
t=0:1/fs:1;
y=cos(2*pi*f*t)+sin(2*2*pi*f*t);
figure 
plot(t,y)

%NFFT = 2^nextpow2(length(t));
NFFT=1024;
z=fft(y,NFFT);
z=z(1:length(t)/2 +1);

freq=0:length(t)/2;
freq=freq*fs/NFFT;
figure
plot(freq,abs(z))

Homework

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

Print Friendly, PDF & Email

Leave a Reply