AMITY SCHOOL OF ENGINEERING
AND TECHNOLOGY
MATLAB REPORT
FILE
Submitted By:
Sagar Wadhwa
A2305107181
B. Tech (ECE), 2007-11
7EC3, 269
Experiment No: 1
Aim:
To implement the arithmetic operations using MATLAB 7.0
Command Instructions:
>> ((35.7*64)-(7^3))/(45+(5^2))
ans =
27.7400
>> ((5/4)*7*(6^2))+(3^7/(9^3-65^2))
ans =
314.3744
>> (((3^7)*log10(76))/((7^3)+546))+(910^(3/2))
ans =
2.7456e+004
>> ((cos ((5*pi)/6)^2)*sin (((7*pi)/8)^2))+ ((tan((pi/6)*log(8)))/(7^(1/2)))
ans =
1.4395
>> cos (((5*pi)/6)^2)*(sin ((7*pi)/8)^2)+ ((tan ((pi/6)*log(8)))/(7*(5/2)))
ans =
0.2325
>> a=15.62
a=
15.6200
>> b=-7.08
b=
-7.0800
>> c=62.5
c=
62.5000
>> d=0.5*((a*b)-c)
d=
-86.5448
>> a+((a*b)/c)*((a+d)^2)/(abs ((a*b)^(1/2)))
ans =
-830.7755
>> (d*(a^(d/2)))+((((a*d)+(c*d))/((20/a)+(30/b)))/(a+b+c+d))
ans =
-147.4700
>> sin ((10*pi)/24)
ans =
0.9659
>> 2*sin((5*pi)/24)*cos((5*pi)/24)
ans =
0.9659
>> x=(3*pi)/17
x=
0.5544
>> q=1+cos(x)
q=
1.8502
>> w=1-cos(x)
w=
0.1498
>> w/q
ans =
0.0810
>> e=(w/q)^(1/2)
e=
0.2845
Result:
The arithmetic functions have been implemented successfully.
Experiment No: 2
Aim:
To implement logarithmic and exponential functions using MATLAB 7.0
Command Instructions:
>> x= [1 2 3]
x=
1 2 3
>> y= [1;2;3]
y=
1
2
3
>> z= [3 1 0]
z=
3 1 0
>> x+y
??? Error using ==> plus
Matrix dimensions must agree.
>> x-y
??? Error using ==> minus
Matrix dimensions must agree.
>> x*y
ans =
14
>> x*z
??? Error using ==> mtimes
Inner matrix dimensions must agree.
>> x.*z
ans =
3 2 0
>> a=linspace(0,2*pi,10)
a=
0 0.6981 1.3963 2.0944 2.7925 3.4907 4.1888 4.8869 5.5851
6.2832
>> subplot(2,2,1);
plot(exp (a))
title(‘sagar’)
>> subplot(2,2,2);
plot(exp (-a))
title(‘sagar’)
>> subplot(2,2,3);
plot(exp (2*a))
>> subplot(2,2,4);
title(‘sagar’)
plot(exp (-2*a))
>> subplot(2,4,1);
title(‘sagar’)
>> w=exp(-0.4*a)
w=
1.0000 0.7563 0.5721 0.4327 0.3273 0.2475 0.1872 0.1416 0.1071
0.0810
>> e=sin(a)
e=
0 0.6428 0.9848 0.8660 0.3420 -0.3420 -0.8660 -0.9848 -0.6428
-0.0000
>> y=w.*e
y=
0 0.4862 0.5634 0.3747 0.1119 -0.0847 -0.1621 -0.1394 -0.0688
-0.0000
>>plot(y)
title(‘sagar’)
>> p=linspace(1,2*pi,10)
p=
1.0000 1.5870 2.1740 2.7611 3.3481 3.9351 4.5221 5.1091 5.6962
6.2832
>> subplot(2,2,1);
>> plot(log(p))
title(‘sagar’)
>> subplot(2,2,2);
>> plot(log(-p))
title(‘sagar’)
>> subplot(2,2,3);
>> plot(log(2*p))
title(‘sagar’)
Output Waveforms:
Fig. 1
Fig. 2
Fig. 3
Result: The logarithmic and exponential functions have been implemented
successfully.