Chapter # 4: Script File

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Chapter # 4

Q2
Script file:
r=4.35;
F=100000;
years=5:10;
%conversion of percent to decimal
r=r/100;
monthly_deposit=F*(r/12)./((1+r/12).^(12*years)-1);
tbl=[years' monthly_deposit'];
disp('Monthly')
disp('Years Deposit')
disp(tbl)
Command window:
Monthly
Years Deposit
5.00 1494.99
6.00 1218.02
7.00 1020.55
8.00 872.78
9.00 758.13
10.00 666.67

Chapter # 5
Q3
Script file:
x=[-4:0.1:4];
y=(x.^2)./(2+sin(x)+x.^4);
plot(x,y)
Figure window:

Q4
Script file:
x=[-2:0.1:4];
y=(x.^3)-(2*x.^2)-(10*(sin(x)).^2)-(exp(0.9*x));
y1=(3*x.^2)-(4*x)-(20*sin(x).*cos(x))-(0.9*exp(0.9*x));

1
plot(x,y,x,y1,'--')
legend('f(x)','f ''(x)')
xlabel('x-->')
ylabel('y-->')
Figure window:

Q8
Script file:
x=(4.2-7.5):.1:(4.2+7.5);
y1=2.7+sqrt(7.5^2-(x-4.2).^2);
y2=2.7-sqrt(7.5^2-(x-4.2).^2);
plot(x,y1,x,y2)
axis([-4 12 -6 12])
axis equal
title('Circle with center (4.2,2.7) and r=7.5')
xlabel('x-->')
ylabel('y-->')
Figure window:

You might also like