summaryrefslogtreecommitdiff
path: root/199/CH8/EX8.2/Example_8_2.sce
blob: 07bd26e44e56faeae053bff78ea5e190c3498cc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Chapter8
// Page.No-326, Figure.No-8.7(a)
// Example_8_2
// Output voltage swing
// Given
clear;clc;
vin=5*10^-3;
R=100;
Vd1=-0.7; // Output voltage during positive half-cycle of the input
Vd2=5.1; // Output voltage during negative half-cycle of the input
printf("\n Output voltage during positive half-cycle of the input is = %.1f V \n",Vd1) // Since zener diode is forward biased
printf("\n Output voltage during negative half-cycle of the input is = %.1f V \n",Vd2) // Since zener diode is reverse-biased
t=0:0.1:2*%pi;
vut=0.5*sin(t);
subplot(2,1,1);
plot(t,vut);
title('Input Voltage');
xlabel('t');
ylabel('Vin');
c=1;
for t=0:0.1:2*%pi
if t<%pi
  v(c)=-0.7;
  else
  v(c)=5.1;
end
c=c+1;
subplot(2,1,2);
plot(v);
end
title('Output Waveform');
xlabel('t');
ylabel('Vo');