MATLAB Plot the signals x(t) and x(t) in figure P1.2-3 using Matlab. Label the s
ID: 2079371 • Letter: M
Question
MATLAB
Plot the signals x(t) and x(t) in figure P1.2-3 using Matlab. Label the signals as X3 and X4. When you run your script, it should automatically plot both signals in a |single figure window with properly labeled (x) and (y) axis. Use Matlab to calculate the energy of the signals x() and x4(t) that you plotted as part of Question 2. Label signal energies as x3 energy and x4 energy. When you run your script, it should automatically calculate and display the answer for all 2 signals. Again For the signal xe() you have plotted for Question 2. plot the following modified signals: x(t - 3) 2* x(t + 1) x4(1 - 2*t) (1/2)*x4(t/1.5) + 1 You can label these signals as x4_ a, x4_ b, x4_ C and X4_ d. When you run your script, it should automatically plot all four signals in a single figure window with properly labeled (X) and (y) axis.Explanation / Answer
% We will use total 1000 points to plot both x3 and x4, which will plot
% both signals from -2.5 to 2.5 on time axis.
N= 1000; % Total number of sample points.
t= linspace(-2.5, 2.5, 1000); % Time axis contains 1000 points extanding from -2.5 to 2.5.
x3= zeros(size(N)); % Creating a vector to store values of x3 and x4
x4= zeros(size(N));
for n= 1:100
x3(n)= 0;
x4(n)= 0;
end
for n=101:500
x3(n)= -.5*t(n)+1;
x4(n)= (4/6)*t(n)+1;
end
for n=501:900
x3(n)= .5*t(n)+1;
x4(n)= -(4/6)*t(n)+1;
end
for n= 901:1000
x3(n)= 0;
x4(n)= 0;
end
figure()
subplot(1,2,1)
plot(t, x3)
xlabel('t')
ylabel('x3')
subplot(1,2, 2)
plot(t, x4)
xlabel('t')
ylabel('x4')
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.