Lab#3
Lab#3
Lab#3
Code 1 Basic:
1) c=2;
2) f=50;
3) t=1/f;
4) t=0:t/20:40*t;
5) ph=pi/4;
6) %%case #1
7) a1=-2;
8) x11=c*exp(a1*t);
9) x12=sin((2*pi*f*t) +ph);
10) x1=x11. *x12;
11) %%case #2
12) a2=0;
13) x21=c*exp(a2*t);
14) x22=sin((2*pi*f*t) +ph);
15) x2=x21. *x22;
16) %%case #3
17) a3=2;
18) x31=c*exp(a3*t);
19) x32=sin((2*pi*f*t) +ph);
20) x3=x31. *x32;
21) subplot (3,1,1)
22) plot (t, x1)
23) title('a<0');
24) subplot (3,1,2)
25) plot (t, x2)
26) title('a=0');
27) subplot (3,1,3)
28) plot (t, x3)
29) title('a>0');
Explanation:
The three output are product of exponential and sine wave.
For negative value of a it is decaying signal.
For a=0 it is pure sine wave.
For possive a it is rising wave.
Subplot gives us plot of three different function on one window.
Page 2 of 3
Graph (subplot):
Code 2:
From line 21 in basic code
Code 3: