%----------------------------------------------------------------------------------
-------
% Tiffany Calbo
%----------------------------------------------------------------------------------
-------
% GENG 2050 - Q1
%----------------------------------------------------------------------------------
-------
% Problem 1:
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
display(' ')
display('|------------------|------------------------------------------------------
-|')
display('|       College    |               Computing and Engineering
|')
display('|------------------|------------------------------------------------------
-|')
display('|    Student Name  |                     Tiffany Calbo
|')
display('|------------------|------------------------------------------------------
-|')
display('|       Course     |    GENG 2050 - Computer Applications in Engineering
|')
display('|------------------|------------------------------------------------------
-|')
display(' ')
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
% Problem 2:
%----------------------------------------------------------------------------------
-------
x = 10;
y = 5;
t = 120;
s = sqrt(x^2 + y^2)*cos(2*pi*t/1000)
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
% Problem 3:
%----------------------------------------------------------------------------------
-------
x = 25;
w = 2*pi/100;
t = 10;
y = 4/(x^(2/3))*exp(-i*w*t)
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
% Problem 4:
%----------------------------------------------------------------------------------
-------
x = 0 : 0.01:10;
y = 5*cos(2*pi*x/100);
figure (1)
set(0,'defaultTextInterpreter','latex');
plot(x,y,'r')
title('Graph of y = 5\cos(2\pi x/100)')
xlabel('x')
ylabel('y')
grid
axis([0 15 0 10])
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
% Problem 5:
%----------------------------------------------------------------------------------
-------
c = [3 -2 4];
r = roots(c)
x = 0:0.01:10;
y = polyval(c,x);
figure(2)
set(0,'defaultTextInterpreter','latex');
plot(x,y,'r')
xlabel('x')
ylabel('y')
title('Graph of y = 3x^3 - 2x^2 + 4')
grid
axis([0 15 0 50])
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
% Problem 6:
%----------------------------------------------------------------------------------
-------
A = [2 -3 4; 6 1 1; -1 4 0];
b = [10;5;-10];
c = A\b
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
% Problem 7:
%----------------------------------------------------------------------------------
-------
x = 2;
y = 1;
3^(x/y)*2^2 - x*y^(1/2) + x/(2*y-3)
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
%Problem 8:
%----------------------------------------------------------------------------------
-------
a = 2;
b = 6;
c = 1;
s1 = (-b + sqrt(b^2 - 4*a*c))/(2*a)
s2 = (-b - sqrt(b^2 - 4*a*c))/(2*a)
p = [a b c];
roots(p)
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
% Problem 9:
%----------------------------------------------------------------------------------
-------
a = 3;
b = 2;
c = 4;
d = 5;
e = 3;
f = 1;
x = 0:0.01:1;
y = a*x.^2 + b*x + c + d*cos(e*x + f)
figure (3)
set(0,'defaultTextInterpreter','latex');
plot(x,y,'b')
title('Graph of y = 3x^2 + 2*x + 4 + 5\cos(3x+1)')
xlabel('x')
ylabel('y')
grid
%----------------------------------------------------------------------------------
-------
%----------------------------------------------------------------------------------
-------
% Problem 10:
%----------------------------------------------------------------------------------
-------
x = 'Happy';
y = 'New';
z = 'Year';
x = input('Happy');
y = input('New');
z = input('Year');
display([x,' ',y,' ',z])