How to increase elements of a vector without changing its plot?
    14 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Hello forum, I have a vector of x elements (57x1) that I would expand to a y-size vector (3000, for example) but without changing its plot (it is a particular stairs plot). Any idea on how to do it?
0 件のコメント
回答 (2 件)
  KL
      
 2017 年 11 月 24 日
        If you have
 X = rand(57,1); %57 elements
if you want to have 3000 elements now,
 X(end+1:end+3000,1) = rand(3000,1);
if you only want to plot the first 57 elements,
 plot(X(1:57,1))
2 件のコメント
  KL
      
 2017 年 11 月 24 日
				
      編集済み: KL
      
 2017 年 11 月 24 日
  
			I'm not clear with what do you mean. Please show me how you create these vectors.
If you want to create more number of elements between the same limits, use linspace.
 x_57 = linspace(1,30,57);
 x_3000 = linspace(1,30,3000);
if you want to "append" more elements to the first vector ( x_57), then
 x_57_new = [x_57 newVector]
参考
カテゴリ
				Help Center および File Exchange で Annotations についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
