MATLAB How to plot a continuous zero plot in Matlab?

AI Thread Summary
The discussion focuses on how to create a continuous zero plot in MATLAB. The initial command provided results in a non-continuous zero plot. To achieve a continuous zero line, it is suggested to define a vector of zeros with the same size as the x vector. Specifically, using the command "y1 = zeros([1 500]);" and then plotting with "plot(x, zeros(size(x)));" ensures that the zero vector matches the dimensions of x, resulting in a continuous line at y=0. This method addresses the issue of discontinuity in the initial plot command.
hokhani
Messages
557
Reaction score
17
In the plot command below
Code:
x=1:5:100
plot(x,y,x,0)

one plot is noncontinuous zero plot. How can I plot a continuous zero one?
 
Physics news on Phys.org
Try
Code:
x = 1:5:100;
plot(x, zeros(size(x));

(Same thing as Dr Transport suggested, except it makes sure the vector of zeros has the same size as x.)
 

Similar threads

Replies
8
Views
2K
Replies
5
Views
2K
Replies
4
Views
2K
Replies
4
Views
4K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
2
Views
3K
Back
Top