x= -2*pi:0.1:2*pi, this means x takes values from the sample in the interval of [-2*pi,2*pi] where sampling inteval is 0.1,
Don't use plagiarized sources. Get Your Custom Essay on
(Solved Homework): Type the following code in Matlab and see the results. X = -2 pi: 0.1: pi 2: step heaviside (X): Exp = exp(X): figu…
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
so x is a array where values are [-2*pi,-2*pi+0.1,-2*pi+0.2,….,2*pi]
step= heaviside(x)
here step is also an array but its values are funtional value corresponding to x, i,e y = [heaviside(-2*pi),heaviside(-2*pi+0.1),….]
Exp =exp(x)
here step is also an array but its values are funtional value corresponding to x, i,e y = [exp(-2*pi),exp(-2*pi+0.1),….]
Now heaviside(x) = 0 for x < 0, 1 for x > 0, and 1/2 for x = 0.
now exp(x) = e^(x) for all x.
subplot baically divide the plotting window in two part with indexes,
usinhg axis we specify the limit on both plotting axis in thwindow. Like axis [-2*pi 2*pi -0.5 1.5] describes x axis should be range from -2*pi to 2*pi and y axis will range fro -0.5 to 1.5.
now to change the first plot you can put step =heaviside(x-1)
for second plot you can do Exp = exp(-x)