Anda di halaman 1dari 4

Electrical and Electronics Engineering Department

Ik University

EE303SIMULATION TOOLS LABORATORY

Assignment 1
Tibet Hatipolu
211BM2018
27.09.2015

Question 1: (20 Pts.) Calculate the following mathematical expressions by using one-line MATLAB
commands.

Answers: >> 8*((12/5)-16)+4^(7-5)


ans = -92.8000
>> 16/33-(4*2^2)+((103-3^6)/205)
ans = -18.5688
>> sqrt(((23^3)*(14-9))/(22-13^2)*(87+5^3))
ans = 0.0000e+00 + 2.9620e+02i
%for the last question i had to assign e for the matlab.
>> e=exp(1)
e =2.7183
>> (sqrt((23-15)/e^28)-23)+2
ans =-21.0000

Question 2:

Answers: First i define the variables a,b,c and x then i define the equation after that i defined
the Delta and the roots.
>> syms a b c x
>> a*x^2+b*x+c==0
ans =a*x^2 + b*x + c == 0
>> a=4
a=4
>> b=-12
b = -12
>> c=-8
c =-8
>> D=b^2-4*a*c
D =272
>> x1=(-b+sqrt(D))/2*a
x1 =56.9848
>> x2=(-b-sqrt(D))/2*a
x2 =-8.9848

Question 3:

Answers: >> %First i will define the formula and the variables.
>> syms A B C x y
>> A*x+B*y+C==0
ans =C + A*x + B*y == 0
>> x=2
x =2
>> y=-4
y =-4
>> A=5
A =5
>> B=2
B =2
>> C=-1
C =-1
%Then i define the distance formula and i take the output.
>> d=(A*x+B*y+C)/sqrt(A^2+B^2)
d = 0.1857

Anda mungkin juga menyukai