Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % %PLOT UNIT STEP FUNCTION
- t=[-10:1:10];
- us=(t>=0);
- subplot(2,2,1);
- plot(t,us);
- % plot(t,us);
- xlabel('Values of t'); %FOR LABELING X AND Y
- ylabel('Amplitude x(t)');
- title('unit step continous 101915122');
- %
- % %PLOT UNIT IMPULSE FUNCTION
- t=[-10:1:10];
- usi=(t==0);
- subplot(2,2,3);
- plot(t,usi);
- xlabel('Values of t'); %FOR LABELING X AND Y
- ylabel('Amplitude x(t)');
- title('unit impulse continous 101915122');
- %
- % %PLOT UNIT STEP FUNCTION
- t=[-10:1:10];
- us=(t>=0); %BY DEFAULT VALUE IS 1
- subplot(2,2,2);
- stem(t,us);
- stem(t,us);
- xlabel('Values of n'); %FOR LABELING X AND Y
- ylabel('Amplitude x(n)');
- title('unit step discrete 101915122');
- %
- % %PLOT UNIT IMPULSE FUNCTION
- t=[-10:1:10];
- usi=(t==0);
- subplot(2,2,4);
- stem(t,usi);
- xlabel('Values of n'); %FOR LABELING X AND Y
- ylabel('Amplitude x(n)');
- title('unit impulse discrete-101915122');
- for x=-10:1:10
- if x>=0;
- a=1;
- hold on;
- else
- a=-1;
- hold on;
- end
- stem(x,a);
- xlabel('Values of n'); %FOR LABELING X AND Y
- ylabel('Amplitude x(n)');
- title('signum discrete 101915122');
- end
- 1b
- %
- t=-2:0.01:2;
- f=3;
- duty1=25;
- duty2=50;
- duty3=75;
- x=square(2*pi*f*t, duty1);
- y=square(2*pi*f*t, duty2);
- z=square(2*pi*f*t, duty3);
- subplot(3,2,1)
- stem(t,x);
- title('Discrete Square Wave, duty cycle=25');
- xlabel('n');
- ylabel('x(n)');
- grid on;
- subplot(3,2,2)
- plot(t,x);
- title('Continuous Square Wave, duty cycle=25(101915122)');
- xlabel('t');
- ylabel('x(t)');
- grid on;
- subplot(3,2,3)
- stem(t,y);
- title('Discrete Square Wave ,duty cycle=50 ');
- xlabel('n');
- ylabel('y(n)');
- grid on;
- subplot(3,2,4)
- plot(t,y);
- title('Continuous Square Wave, duty cycle=50 (101915122)');
- xlabel('t');
- ylabel('y(t)');
- grid on;
- subplot(3,2,5)
- stem(t,z);
- title('Discrete Square Wave, duty cycle=75 ');
- xlabel('n');
- ylabel('z(n)');
- grid on;
- subplot(3,2,6)
- plot(t,z);
- title('Continuous Square Wave, duty cycle=75 (101915122)');
- xlabel('t');
- ylabel('z(t)');
- grid on;
- % 1c
- a1=1;
- f1=1;
- p1=0;
- a2=2;
- f2=1;
- p2=pi;
- t=(-10:0.1:10);
- x1=a1*(sin((2*pi*f1*t)+ p1));
- subplot(2,1,1);
- plot(t,x1);
- grid on;
- title('Sine Wave[a=1,f=1,p=0] (101915122)');
- xlabel('t');
- ylabel('t(x)');
- x2=a2*(sin((2*pi*f2*t)+ p2));
- subplot(2,1,2);
- plot(t,x2);
- grid on;
- title('Sine Wave[a=2,f=1,p=pi] (101915122)');
- xlabel('t');
- ylabel('t(x)');
Advertisement
Add Comment
Please, Sign In to add comment