blob: e0eecdad941918bc646ac58c71f96a71327326b5 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
//example 8.1 (a)//
clear
//clears the screen//
clc
//clears the variable//
close
//R =input('Enter the value of the resistance R in Kohms : ')//
//C =input('Enter the value of the Capacitance C in micro farads : ' ) ;
sp =input ('Enter the spacing between two input pulses in microseconds: ' );
R =14.5;
//taking give values//
C =0.01;
t= 693* R*C;
//calculting time constant//
tt=t*10;
p =1;
len =sp*60 -1;
q =1;
for j=1: len
//plotin the graphs//
lo = sp *10;
f= modulo (j,lo);
if f ==0 then
inpu (j)=1;
else
inpu (j)=0;
end
inpu (1) =1;
o(j)=2;
end
while q<len
result (q) =0;
q=q+1;
end
while p<len
if inpu (p)==1 then
for k=1: tt
result (p+k) =1;
end
p=p+tt;
else
result (p) =0;
p=p+1;
end
end
subplot (2 ,1 ,1);
//ploting bothe graphs in same window//
plot (o);
plot ( inpu );
xlabel ( ' time X10^7 seconds ' );
ylabel ( 'Magnitude ' ) ;
title ( ' input pulses ' );
subplot (2 ,1 ,2);
plot (o);
plot ( result );
xlabel ( ' t ime X10^7 seconds' );
ylabel ( 'Magnitude' );
title ( ' Output ' );
|