- ‘plot’: creates a 2-D line plot https://www.mathworks.com/help/matlab/ref/plot.html?searchHighlight=plot&s_tid=srchtitle_support_results_1_plot
- ‘length’: returns the length of the largest array dimension http://www.mathworks.com/help/matlab/ref/length.html?searchHighlight=length&s_tid=srchtitle_support_results_1_length
Why is this code not creating the plot ?
1 次查看(过去 30 天)
显示 更早的评论
Is showing a message saying "error using plot Vectors must be the same lenght "![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/826570/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/826570/image.png)
0 个评论
回答(1 个)
Jaswanth
2023-12-27
编辑:Jaswanth
2023-12-27
Hi Josue Alvarado Rivera,
I understand that you want to know the reason why the specified code is not creating the plot. From the information you have provided related to the code and the error message, the most likely reason could be that the x and y variables you are trying to plot are of different lengths.
For vector and matrix data, to plot a set of coordinates connected by line segments, x and y need to be specified as vectors of the same length.
Kindly verify the length of the vectors x and y using the following command and check if they are the same.
length(x)
length(y)
Please refer the following MathWorks documentation to know more about the functions mentioned above.
Hope the provided information helps you in rectifying your problem.
Thanks.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!