Solution:: Output
Solution:: Output
Solution:
clc
clear all
a=2.^3+7.^3+(273.^(2/3))/2+(55.^(3/2));
b=((3.^7)*log(76))/((7.^3)+546)+910.^(1/3);
c=43*(((250.^(1/4)+23).^2)/exp(45-3.^3));
d=(1+2-exp(-3)+sin(5))/(cos(6)-7.^(-8));
fprintf('The magnitude of the given expressions are
below\n\n(a)%f\n\n(b)%f\n\n(c)%f\n\n(d)%f\n',a,b,c,d)
Output:
(a)779.932501
(b)20.344417
(c)0.000477
(d)2.073892
>>
Solution:
clc
clear all
x=9.6;
z=8.1;
a=(x*z.^2)-((2*z)/(3*x)).^(3/5);
b=((443*z)/(2*x.^3))+((exp(-x*z))/(x+z));
fprintf('The magnitude of the given expressions are
below\n\n(a)%.10f\n\n(b)%.10f\n',a,b)
Output:
(a)629.1479343665
(b)2.0278930664
>>
Solution:
clc
clear all
a=15.62;
b=-7.08;
c=62.5;
d=0.5*(a*b-c);
r1=a+((a*b*(a+d).^2)/(c*sqrt(abs(a*b))));
r2=(d*exp(d/2))+((a*d+c*d)/((20/a)+(20/b)))/(a+b+c+d);
fprintf('The magnitude of the given expressions are
below\n\n(a)%.15f\n\n(b)%.15f\n',r1,r2)
Output:
The magnitude of the given expressions are below
(a)-830.775539343049790
(b)-282.334184942866900
>>
Solution:
clc
clear all
r1=(((cos(5*pi/6)).^2)*(sin(7*pi/8).^2))+((tan(pi*log(8)/6))/sqrt(7
));
r2=((cos(5*pi/6).^2)*((sin(7*pi/8)).^2))+((tan(pi*log(8)/6))/(7*(5/
2)));
r3=sin(acos(1/2)+atan(1));
r4=cos(asin(sqrt(3)/2)+acot(sqrt(3)));
r5=tan(asin(3/4)-acos(1/3));
fprintf('The magnitude of the given expressions are
below\n\n(a)%f\n\n(b)%f\n\n(c)%f\n\n(d)%f\n\n(e)%f\n',r1,r2,r3,r4,r
5)
Output:
The magnitude of the given expressions are below
(a)0.832300
(b)0.219061
(c)0.965926
(d)0.000000
(e)-0.402776
>>
Solution:
clc
clear all
alpha=(5*pi)/6;
beta=pi/7;
aLHS=cos(alpha)-cos(beta);
aRHS=2*sin((1/2)*(alpha+beta))*sin((1/2)*(beta-alpha));
bLHS=(sin(alpha+beta)-sin(alpha-beta))/(cos(alpha+beta)+cos(alpha-
beta));
bRHS=tan(beta);
disp('===========OUTPUT=============')
fprintf('The required value of the LEFT HAND SIDE of the given
equation (a)=%.8f\n',aLHS)
===========OUTPUT=============
The required value of the LEFT HAND SIDE of the given equation (a)=-1.76699427
The required value of the RIGHT HAND SIDE of the given equation (a)=-1.76699427
The required value of the LEFT HAND SIDE of the given equation (b)=0.48157462
The required value of the RIGHT HAND SIDE of the given equation (b)=0.48157462
>>
Solution:
clc
clear all
A = [75000 100000 300000 500000 1199900];
r = 0.09;%rate of interest is 9 percent
n = 10;%time is 10 years
B = A*(1 + r).^n;
table=[A;B];
fprintf('Investement Final balance\n\n')
fprintf('%d %.5f\n',table)
%disp( [A' B'] )
Output
Investement Final balance
75000 177552.27559
100000 236736.36746
300000 710209.10238
500000 1183681.83730
1199900 2840599.67314
>>
Solution:
clc
clear all
P=400000; % total invesment
r = 0.085; % interest rate
t = 17; % invesment years
n=12; % 1 year= 12 months
B = P*(1 + r).^t;
fprintf('The final balance after 17 years %.3f is %.6f\n',P,B) %
solution of 1st question
time=log(B/P)/(n*log(1+r/n));% time calculated
years=fix(time)% fixing time
months=ceil((time-years)*12)
Output:
The final balance after 17 years 400000.000 is 1600904.924208
years =
16
months =
>>
Solution:
clc
clear all
Tb=256.93*82.85;% 1 US dollar=82.85 taka
Cp=89.99*82.85; % 1 US dollar=82.85 taka
Tp=2*Tb+8*Cp; % price of 2 tables and 8 chairs
W_tax=Tp+Tp*(5.5/100); % price of 2 tables and 8 chairs with 5.5
percent tax
disp('===============================OUTPUT========================
=======')
fprintf('The required cost of two tables and eight chairs=%f
taka\n',Tp) % solution of 1st question
fprintf('The required cost of two tables and eight chairs with 5.5
percent tax=%f taka\n',W_tax) % solution of 2nd question
===============================OUTPUT===============================
The required cost of two tables and eight chairs=102218.673000 taka
The required cost of two tables and eight chairs with 5.5 percent tax=107840.700015 taka
>>
Solution:
clc
clear all
r1=10; % external diameter
r2=2; % internal diameter
V=(4/3)*pi*(r1.^3-r2.^3); % Volume formula
disp('===============================OUTPUT========================
=======')
fprintf('The required volume of a shell=%f\n',V)
===============================OUTPUT===============================
The required volume of a shell=4155.279883
>>
Solution:
clc
clear all
disp('===============================INPUT=========================
=======')
F=input('Enter the temperatures in degrees Fahrenheit=');
C=5*(F-32)/9;
K=C+273.15;
disp('===============================OUTPUT========================
=======')
===============================INPUT================================
Enter the temperatures in degrees Fahrenheit=12
===============================OUTPUT===============================
The required temperatures in 12.0000 degrees Fahrenheit is -11.11111 degree Centigrade and
262.03889 degree Kelvin
The required temperatures in 12.0000 degrees Fahrenheit is -1.1111111e+001 degree Centigrade
and 2.6203889e+002 degree Kelvin
The required temperatures in 12 degrees Fahrenheit is -11.11 degree Centigrade and 262 degree
Kelvin
>>
Solution:
clc
clear all
x=input('Enter the initial inches=');
f=x+3*9; % Here 9 is stands for lines
I=x:3:f;
CM=I*2.54;%Since 1 inch = 2.54 cm
table=[I;CM];
fprintf('Conservation from inches to centimeters\n')
fprintf('inches\t\t\t\t centimeters\n')
fprintf('%.2f\t\t\t\t\t%.5f\n',table)
Output:
Enter the initial inches=15
Conservation from inches to centimeters
inches centimeters
15.00 38.10000
18.00 45.72000
21.00 53.34000
24.00 60.96000
27.00 68.58000
30.00 76.20000
33.00 83.82000
36.00 91.44000
39.00 99.06000
42.00 106.68000
>>
Solution:
clc
clear all
linspace(7,47.5,15)
Output:
ans =
Columns 1 through 7
Columns 8 through 14
Column 15
47.5000
>>
Solution:
clc
clear all
B=[7:0.16:23];
Display=B(18)
Output:
Display =
9.7200
>>
Solution:
clc
clear all
%x=[-2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5];
x=-2.5:0.5:2.5;
y=(x.^2+1).^3.*(x.^3);
disp('===========OUTPUT============')
table=[x;y];
fprintf('Conversion from x to y\n')
fprintf('x y\n\n')
fprintf('===== ==========\n');
fprintf('%.2f %.4f\n',table)
===========OUTPUT============
Conversion from x to y
x y
===== ==========
-2.50 -5954.3457
-2.00 -1000.0000
-1.50 -115.8574
-1.00 -8.0000
-0.50 -0.2441
0.00 0.0000
0.50 0.2441
1.00 8.0000
1.50 115.8574
2.00 1000.0000
2.50 5954.3457
>>
Solution:
clc
clear all
g=9.81; %acceleration (meter per second sq)
t=linspace(1,10,10); %time (seconds)
d=(1/2)*g*t.^2; %the depth of a well
table=[t;d];
fprintf('Time(seconds)\t\tDepth of a well(meters)\n')
fprintf('------------\t\t----------------------\n\n')
fprintf('%d\t\t\t\t\t\t\t%f\n\n',table)
Output:
Time(seconds) Depth of a well(meters)
------------ ----------------------
1 4.905000
2 19.620000
3 44.145000
4 78.480000
5 122.625000
6 176.580000
7 240.345000
8 313.920000
9 397.305000
10 490.500000
>>
Solution:
clear all
clc
x=2:2:10;
y=3:3:15;
z=(((x.*y)+(y./x))./((x+y).^(y-x)))+12.^(x./y);
table=[x;y;z];
fprintf('The required value of z with respect to x and y\n')
fprintf('x\t\t\t\t y\t\t\t\t z\n')
fprintf('-----\t\t\t-----\t\t\t-----\n')
fprintf('%d\t\t\t\t %d\t\t\t %.6f\n',table)
Output:
The required value of z with respect to x and y
x y z
----- ----- -----
2 3 6.741483
4 6 5.496483
6 9 5.257927
8 12 5.242092
10 15 5.241498
>>
Solution:
clear all
clc
h=0.9;
k=12.5;
x=1:1:4;
y=0.9:-0.1:0.6;
z=2.5:0.5:4;
T=((x.*y.*z)./((h+k).^(k/5)))+(k*exp((z./x)+y))./z.^h;
Table=[x;y;z;T];
fprintf('The required value of T with respect to h,k,x,y and z\n')
fprintf('x\t\t\t y\t\t\t\t z\t\t\t\t T\n')
fprintf('%d\t\t %f\t\t %f\t\t %f\n',Table)
Output:
The required value of T with respect to h,k,x,y and z
x y z T
Solution:
clc
clear all
r=3:8; %radii
A=pi*r.^2; % Area of circles
table=[r;A];
disp('=========OUTPUT========')
fprintf('radii\t\t\t\t\tArea of circles\n')
fprintf('------------\t\t----------------------\n\n')
fprintf('%.2f\t\t\t\t\t\t\t%.4f\n\n',table)
=========OUTPUT========
radii Area of circles
------------ ----------------------
3.00 28.2743
4.00 50.2655
5.00 78.5398
6.00 113.0973
7.00 153.9380
8.00 201.0619
>>
Solution:
clc
clear all
R=1:1:3;
y=5;
theta=pi*20/180;
V=(pi*R.^3)/(3*tan(theta))+(pi/3)*((R-
y*tan(theta)).^2).*(R/tan(theta)-y);
disp('===========OUTPUT============')
table=[R;V];
fprintf('Conversion from R to V\n')
fprintf('R V\n\n')
fprintf('===== ==========\n');
fprintf('%.2f %.6f\n',table)
===========OUTPUT============
Conversion from R to V
R V
===== ==========
1.00 1.291646
2.00 23.034034
3.00 82.412135
>>
Solution:
clc
clear all
A=[7 2;3 1];
B=[2 3;-4 -5];
r1=A+B
r2=A-B
r3=2*B
r4=A/4
r5=A.*B
r6=B.*A
r7=A*B
r8=A.^2
r9=A^2
r10=A.^B
r11=A./B
Output:
r1 =
9 5
-1 -4
r2 =
5 -1
7 6
r3 =
4 6
-8 -10
r4 =
1.7500 0.5000
0.7500 0.2500
r5 =
14 6
-12 -5
r6 =
14 6
-12 -5
r7 =
6 11
2 4
prepared by K. M. Ashikur Rahaman
15
r8 =
49 4
9 1
r9 =
55 16
24 7
r10 =
49.0000 8.0000
0.0123 1.0000
r11 =
3.5000 0.6667
-0.7500 -0.2000
>>
Solution:
clc
clear all
A=[12.11 -7.9 9.23;5.06 6.35 21.7;-3.34 2.67 14.38];
r1=log(abs(A))
r2=log10(abs(A))
r3=sqrt(A)
r4=cosh(A)
r5=round(A)
r6=ceil(A)
r7=fix(A)
r8=sum(A)
r9=prod(A')'
r10=max(A)
r11=min(A')'
r12=sort(A)
r13=sort(A')'
r14=mean(A)
r15=size(A)
Output:
r1 =
r2 =
r3 =
r4 =
1.0e+009 *
r5 =
12 -8 9
5 6 22
-3 3 14
r6 =
13 -7 10
6 7 22
-3 3 15
r7 =
12 -7 9
5 6 21
-3 2 14
r8 =
r9 =
-883.0249
697.2427
-128.2380
r10 =
r11 =
-7.9000
5.0600
-3.3400
r12 =
r13 =
r14 =
r15 =
3 3
>>
Solution:
clc
clear all
A=[6 -3 4;12 5 -7;-5 2 6];
B=[41;-26;14];
r=inv(A)*B;
fprintf('a:\n')
fprintf('x y z\n')
fprintf('%3.2f %3.2f %3.2f\n',r)
Output:
a:
x y z
2.00 -3.00 5.00
>>
Solution:
clc
clear all
A=[1 -2 5 2.5;10 25 -6.2 18;25 -30 -15 28;-3.2 0 12 -8];
B=[-4;2.9;-5.2;-4];
x=inv(A)*B;
fprintf('a:\n')
fprintf('x1 x2 x3 x4\n')
fprintf('%f %f %f %f\n',x)
Output:
a:
x1 x2 x3 x4
0.131489 0.202049 -0.553817 -0.383321
>>
Solution:
clc
clear all
x1=-4:0.01:4;
x2=-2.7:0.01:2.7;
y1=0.6.*x1.^5-5.*x1.^3+9.*x1+2;
y2=0.6.*x2.^5-5.*x2.^3+9.*x2+2;
plot(x1,y1,'r-.','linewidth',1.5,'markersize',15)
%axis on('[-10 10],[0 0]')
xlabel('x(cm)','fontsize',12)
ylabel('y(cm)','fontsize',12)
title('x as a function of y','fontsize',12)
axis([-4 4 -100 100])
%text(-7.8,70,'Comparison between -4<=x<=4 and -
2.7<=x<=2.7','edgecolor','k','linewidth',1)
hold on
plot(x2,y2,'k-','linewidth',.5,'markersize',15)
legend('-4<=x<=4','-2.7<=x<=2.7',0)
%axis equal
plot([-4 4],[0 0],'k')
plot([0 0],[-100 100],'k')
grid off
hold off
Output:
80
60
40
20
y(cm)
-20
-40
-4<=x<=4
-2.7<=x<=2.7
-60
-80
-100
-4 -3 -2 -1 0 1 2 3 4
x(cm)
Solution:
clc
clear all
x=-10:1:10;
y=(x.^2+x+1)./(x.^2-x+1);
plot(x,y,'--k')
xlabel('x')
ylabel('y')
title('Graph of a polynomial function')
legend('y')
Output:
2.5
1.5
y
0.5
0
-10 -8 -6 -4 -2 0 2 4 6 8 10
x
Solution:
clc
clear all
x=linspace(-4,6,200);
y=(0.01.*(x.^5)-0.03.*(x.^4)+0.4.*(x.^3)-2.*(x.^2)-6.*x+5);
plot(x,y,'--r')
20
10
-10
-20
-30
-40
-50
-4 -3 -2 -1 0 1 2 3 4 5 6
Solution:
clc
clear all
x=linspace(-2*pi,2*pi,180);
y=3.*x.*cos(x)-3.*sin(x)-2.*x;
plot(x,y,'-.k')
z=3.*cos(x)-3.*sin(x)-2;
hold on
plot(x,z,'--r')
xlabel('x')
ylabel('y')
hold off
Output:
20
15
10
0
y
-5
-10
-15
-20
-8 -6 -4 -2 0 2 4 6 8
x
Solution:
clc
clear all
r1=3:1:10;
r2=2;
V=(4/3)*pi*(r1.^3-r2.^3);
plot(r1,V,'k');
%bar(r1,V,'k-.','linewidth',2.5,'markersize',15)
xlabel('Externat radius(cm)','fontsize',12)
ylabel('Volume(cubic cm)','fontsize',12)
%title('Comparing the graph between sinx and cosx','fontsize',12)
axis([0 10 -400 4000])
%text(-7.8,70,'Comparison between -4<=x<=4 and -
2.7<=x<=2.7','edgecolor','k','linewidth',1)
%hold on
%plot(x2,y2,'k-.','linewidth',1.5,'markersize',15)
legend('Volume',0)
%axis equal
%plot([0 10],[0 0],'k')
%plot([0 0],[-400 4000],'k')
%hold off
Output:
4000
Volume
3500
3000
Volume(cubic cm)
2500
2000
1500
1000
500
0 1 2 3 4 5 6 7 8 9 10
Externat radius(cm)
Solution:
clc
clear all
t=linspace(-5,5,20);
x=2+3.*sin(pi.*t+10).*exp(-0.35.*t);
plot(t,x,'--')
xlabel('t')
ylabel('x')
title('graph of a trigonometric function')
axis([-20 20 -6 6])
0
x
-2
-4
-6
-20 -15 -10 -5 0 5 10 15 20
t
Solution:
clc
clear all
EL=0:10.^(-3):10*10.^(-3);
ITF=[0 1000 1700 3300 4500 7000 10400 12100 13300 14100 14700];
DTF=[0 0 1500 2200 3600 5900 8700 11400 12900 13300 14700];
plot(EL,ITF,('sk'))
hold on
plot(EL,DTF,'vr')
xlabel('Elogation(inches)')
ylabel('depenndent variable(lbs)')
legend('Increasing tension force','Decreasing Tension force')
Output:
15000
Increasing tension force
Decreasing Tension force
depenndent variable(lbs)
10000
5000
0
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
Elogation(inches)