Question about plotting, getting subvectors

1 次查看(过去 30 天)
Hi,
I'm new to Matlab central, but not new to Matlab itself. I'm running a simulation which has an end results of two columns of values. I ususally plot these values using plot(1stcolumn,2ndcolumn). My question is: how do I plot only a small amount of these values? Like say 1stcolumn(40) to 1stcolumn(60)? I've tried exactly this in Matlab, but I am only getting an empty graph sheet (no errors are showing either):
plot(1stcolumn(40),2ndcolumn(40),1stcolumn(40),...
2ndcolumn(40)1stcolumn(40),2ndcolumn(40),...
1stcolumn(40),2ndcolumn(40))
What am I doing wrong?
RebSam

采纳的回答

Paulo Silva
Paulo Silva 2011-7-30
vector(1:40) %get all values from index 1 to 40
Your mistake is that you just plot the value at index 40 with your code vector(40)

更多回答(2 个)

Jan
Jan 2011-7-30
"1stcolumn", "2ndcolumn" etc are no valid Matlab symbols, because they start with a number. Are you sure that the posted code does not produce errors?!
  1 个评论
Paulo Silva
Paulo Silva 2011-7-30
good catch, for some strange reason I didn't noticed that the variables started with numbers, too much trust on OP codes.

请先登录,再进行评论。


REBECCA
REBECCA 2011-8-1
Sorry,
I just picked the first thing that came to my head when I was posting. That's not the actual name. It more like n1(...) and y1(...).
  1 个评论
Paulo Silva
Paulo Silva 2011-8-1
REBECCA and all that might read this, please do the effort of trying the code first before asking questions, that saves us time and we can use the extra time to help others.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by