plotting discrete time signals

2 vues (au cours des 30 derniers jours)
William
William le 11 Sep 2013
I'm trying to plot a discrete time signal with a step function from -5 to 5 I am trying to use the heaviside() function but keep getting errors. Can anyone tell me why this is invalid matlab syntax?
n = [-5 -4 -3 -2 -1 0 1 2 3 4 5];
f_one = 2*(0.5)^.n * heaviside(n.+2)

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 11 Sep 2013
Modifié(e) : Azzi Abdelmalek le 11 Sep 2013
% You have so
n = [-5 -4 -3 -2 -1 0 1 2 3 4 5];
f_one = 2*0.5.^n.* heaviside(n+2)
stem(n,f_one)
% The operator .+ does not exist in Matlab

Plus de réponses (2)

William
William le 11 Sep 2013
Thanks again for your help! It's been three in a row :) You're awesome!

aswathy  subash
aswathy subash le 1 Mai 2019
matlab program for to sketch magnitude and phase spectrum of discrete time system H(e^jw)=(1-e^(-3jw))/3(1-e(-jw) )

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by