summaryrefslogtreecommitdiff
path: root/2528/CH10/EX10.3/Ex10_3.sce
blob: 78868b48f2b2d0396f07a5fe424cf89b04fe5117 (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
//Chapter 10
//Sketch the output Waveform 
//page no.  358
//Example10_3
//Figure 10.7
//Given
clc;
clear; 
T0=4;
t=-5.99:0.01:6;
t_temp=0.01:0.01:T0/4;
s=length(t)/length(t_temp);
dx=[];
x=[];
for i=1:s
    if modulo(i,2)==1  then
        dx=[dx -ones(1,length(t_temp))];
        x=[x .1*t_temp($:-1:1)];
    else
        dx=[dx ones(1,length(t_temp))];
        x=[x .1*t_temp]; 
    end
end
clf();
subplot(1,2,2)
plot(50*t,10*x-0.5,8)
xtitle("Output Waveform","Microsecond","V");
t=-30:0.01:30;
subplot(1,2,1);
plot('onn',10*t,[2*squarewave(2*t/(%pi),50)])
xtitle("Input Waveform","Microsecond","V");