Hello
I am a first time MATLAB user, because of some homework. I have to plot some signals, and I am not sure If I am doing it as it is supposed to be. Please take a look at my code:
and that code:
Thanks!
I am a first time MATLAB user, because of some homework. I have to plot some signals, and I am not sure If I am doing it as it is supposed to be. Please take a look at my code:
Code:
% Plots the signal x[n] = 3.8u[n + 7] in the interval -10 to 10
% Unfinished!
clear all
clc
n = -10:1:10;
x = 3.8*((n+7)>=0);
stem(n, x, 'filled');
axis([-10 10 -0.5 5.5]);
ylabel ('Magnitude');
xlabel ('Sample Number');
title ('Signal');
legend('x[n] = 3.8u[n + 7]');
Code:
% Plots the signal x[n] = 2.7d[n - 20] in the interval 0 to 25
% Unfinished!
clear all
clc
n = 0:1:25; % sample vector
x = 2.7*(n-20==0); % signal vector
stem(n, x, 'filled');
axis([0 25 -0.5 2]);
ylabel ('Magnitude');
xlabel ('Sample Number');
title ('Signal');
legend('x[n] = 2.7\delta[n - 20]');