clc

clear all
close all

for i=1:1:2

% calculation of equivalent resistance :

if i==1
syms r2n r1n r23 r13 r22 r12 r21 r11
end

if i==2
r2n = 2;
r1n = 4;
r23 = 6;
r13 = 8;
r22 = 10;
r12 = 12;
r21 = 14;
r11 = 16;
end

ra = r2n + r1n ; % series
rb = (ra * r23) / (ra + r23) ; % parallel

rc = r13 + rb ; % series
rd = (rc * r22) / (rc + r22) ; % parallel

re = r12 + rd ; % series
rf = (re * r21) / (re + r21) ; % parallel

rg = r11 + rf; % series

req = rg
% calculation of power dissipation by resistror r2n :

if i==1
syms vs
end

if i==2
vs = 12 ;
end

i = vs / req ;

p_dis_r2n = (i^2) * r2n

end

***********************

clc
clear all
close all

x = -100:100;

fx = sin(x) ;

f1x = x ;

f2x = x – (1/6)*(x.^3) ;

f3x = x – (1/6)*(x.^3) + (1/120)*(x.^5);

% plots :

figure

subplot(4,1,1)
plot(x,fx,’linewidth’,2)
title(‘fx’,’fontsize’,15)

subplot(4,1,2)
plot(x,f1x,’linewidth’,2)
title(‘f1x’,’fontsize’,15)

subplot(4,1,3)
plot(x,f2x,’linewidth’,2)
title(‘f2x’,’fontsize’,15)

subplot(4,1,4)
plot(x,f3x,’linewidth’,2)
title(‘f3x’,’fontsize’,15)
% zoomed plots :

figure

subplot(4,1,1)
plot(x,fx,’linewidth’,2)
xlim([-5 5])
title(‘fx zoom view’,’fontsize’,15)

subplot(4,1,2)
plot(x,f1x,’linewidth’,2)
xlim([-5 5])
title(‘f1x zoom view’,’fontsize’,15)

subplot(4,1,3)
plot(x,f2x,’linewidth’,2)
xlim([-5 5])
title(‘f2x zoom view’,’fontsize’,15)

subplot(4,1,4)
plot(x,f3x,’linewidth’,2)
xlim([-5 5])
title(‘f3x zoom view’,’fontsize’,15)