In this assignment you are going to write Matlab functions I
In this assignment, you are going to write Matlab functions,
In order for all this to work properly and look nice, you need to do a few things.
1. Please make sure that your functions produce no typed output. They only should produce the plots that are specified.
2. Each of your functions should have the following as the first line of code (after the function statement and comments); set(clf, ‘Color’, ‘w’);
This line will assure that the figure is cleared and that the background color is white.
Given the plot of x (t ) below, create a Matlab function, lab1_2.m, that when run produces plots of the following over the interval ?4
a. x(t-1)
b. x(3+t)
c. x(t)+1
d. x(2t)
e. x(t/2 +1)
f. tx(t)
-2 -1 A very important class of signals of the form x(t) = e-\" cos(ot + )a(t)Solution
close all;
clear all;
clc;
x0(1:20)=0;
t2=0:.1:1.9;x1=t2;
x2(1:10)=0;
x=[x0 x1 x2];
t=-2:.1:2.9;
figure;
plot(t,x,\'b\',\'Linewidth\',2);
title(\'x(t)\');
figure;
plot(t-1,x);
title(\'x(t-1)\');
figure;
plot(t+3,x);
title(\'x(3+t)\');
figure;
plot(t,x+1);
title(\'x(t)+1\');
figure;
plot(t/2,x);
title(\'x(2t)\');
figure;
plot(2*t+1,x);
title(\'x(t/2+1)\');
figure;
plot(t,t.*x);
title(\'tx(t)\');
the same code copied from word document; dont confuse ;
close all;
clear all;
clc;
x0(1:20)=0;
t2=0:.1:1.9;x1=t2;
x2(1:10)=0;
x=[x0 x1 x2];
t=-2:.1:2.9;
figure;
plot(t,x,\'b\',\'Linewidth\',2);
title(\'x(t)\');
figure;
plot(t-1,x);
title(\'x(t-1)\');
figure;
plot(t+3,x);
title(\'x(3+t)\');
figure;
plot(t,x+1);
title(\'x(t)+1\');
figure;
plot(t/2,x);
title(\'x(2t)\');
figure;
plot(2*t+1,x);
title(\'x(t/2+1)\');
figure;
plot(t,t.*x);
title(\'tx(t)\');
I again remodified with subplot command;
close all;
clear all;
clc;
x0(1:20)=0;
t2=0:.1:1.9;x1=t2;
x2(1:10)=0;
x=[x0 x1 x2];
t=-2:.1:2.9;
figure;
plot(t,x,\'b\',\'Linewidth\',2);
title(\'x(t)\');
subplot(3,2,1);
plot(t-1,x,\'c\');
title(\'x(t-1)\');
subplot(3,2,2);
plot(t+3,x,\'r\');
title(\'x(3+t)\');
subplot(3,2,3);
plot(t,x+1,\'g\');
title(\'x(t)+1\');
subplot(3,2,4);
plot(t/2,x,\'m\');
title(\'x(2t)\');
subplot(3,2,5);
plot(2*t+1,x,\'y\');
title(\'x(t/2+1)\');
subplot(3,2,6);
plot(t,t.*x,\'k\');
title(\'tx(t)\');


