Plotting certain values of a matrix
显示 更早的评论
Hello I have a 100x1 matrix and would like to plot n=2 and n=100 values against x how would I go about doing this? Thanks for any help
采纳的回答
plot(repmat(100,100,1),x)
% ^^^-—-—-n
hold on
plot(repmat(2,100,1),x)
9 个评论
How do I use my N=100x1 matrix in this method?
Not clear what your trying to do.
I have a matrix 'N' which is 100x1, I would like to plot the second and last value against x. How do I do this?
size(x) ?
plot(N([1 end]),x([1 end]))
Sorry I don't follow, it didn't seem to work, what do the 1's and end's do? Sorry very new to Matlab.
Sorry it was supposed to be :
[2 end] % second and last element
Thanks think I got it now. Sorry one more thing, how could I add another line to this plot? eg: 'y' It is a bit confusing.
'y' represents color of the plot which is yellow.
See my original answer after using hold on plot another line to the same figure
doc hold
doc plot
I suggest you to do MATLAB onramp course which is free and takes few hours to complete by then you will get know the basics of MATLAB.
Thanks for the help
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
