matlab - Plotting a Continous signal -
I am trying to print a continuous signal according to the image given below:
< Img src = "https://i.stack.imgur.com/4n9J9.png" alt = "Enter image details here">
Below is my code:
< Code> x = [0 0 1 1 1 1 1-1 -1 -1 0]; N = [6 -5 -4 -3 -2 -1 0 2 2 3 4 5 6]; subplot (2,2,2); Axis ([min (n) -10, max (n) + 10, min (x) -10, max (x) 10]); Plot (n, x); On the grid; Xlabel ('time'); Ylabel ('x2 (t)'); Title ('continuous signal');But output plot size does not match expectations:
![]()
Is it that in MATLAB we can not constantly display the signal properly? If yes, then what changes should I make in my code?
Why are the line of lines not connected through a straight line - it creates a curve (or straight line)?
You are looking for a function:
x = [ 0 0 1 1 1 1 1 1 -1 -1 0]; N = [-6 -5 -4 -3 -2 -1 0 2 2 3 4 5 6]; Stairs (N, X);
![]()
Comments
Post a Comment