CSE 432 Fall 2019 Lab 6

November 11, 2019

Task 1

  • Symbolic Algebra in Matlab
    • Solving Single Variable Equation
    • Solving Multi Variable Equation
    • Solving Simultaneous Equation
    • Using roots and polyval function
    • Using expand function to expand algebraic expression
    • Using simplify function to simplify algebraic expression
    • using factor function to factorize algebraic expression
%Lab 6 Task 1
close all
clear
clc


a=solve('3*x-50=0');
disp(a)

b=solve('3*x^2+5*x-3=0');
pretty(b)

%Using roots function to find the roots of a polynomial
p=[3 5 -3];
roots(p)

%q(x)=5*x^4+3*x^2+5*X+9
q=[5 0 3 5 9];
roots(q)

q=[5 0 5 0 5 3 6 4 5];
roots(q)
polyval(q,3)

%5x^2+3xy+9
pretty(solve('5*x^2+3*x*y+9'))
pretty(solve('5*x^2+3*x*y+9','y'))

%2x+3y+9z=5
%3x-2y+3z=2
%5x+5y+9z=100

solu=solve('2*x+3*y+9*z=5','3*x-2*y+3*z=2','5*x+5*y+9*z=100');
disp(solu.x);
disp(solu.y);
disp(solu.z);

%Expansion, factorization and simplification 
syms x y a b;
expand((x-2)*(x+5))
expand((x-2)^2*(x+5)^2)
pretty(expand((x-2)^2*(x+5)^2))
expand(cos(x+y))
expand(cos(x+y)^2)
expand(exp(a+b)^2)

factor(x^4 + 6*x^3 - 11*x^2 - 60*x + 100)
simplify((x^4 + 6*x^3 - 11*x^2 - 60*x + 100)/(x-2))

Task 2

Integration and Differentiation in Matlab

%Lab 6 Task 2
close all
clear
clc

syms x t;
f=sin(x)^2;
diff(f)
diff(diff(f))
diff(sin(x),52)
int(sin(x),  -pi, pi)

Task 3

Symbolic Fourier Transform in Matlab

%Lab 6 Task 3
close all
clear
clc

syms a t w x;
pretty(fourier(exp(-a*t)*heaviside(t)))
pretty(fourier(dirac(t)))
pretty(fourier(fourier(dirac(t))))
pretty(fourier(heaviside(t)))

Homework

Find the Fourier Transform of as many function of the tables in book.

Print Friendly, PDF & Email

Leave a Reply