![]() |
生成n个样本并将其标记为Matlab
如何生成n个样本并在另一列中用数字标记。
我有这个: n= 5; sample1= randn(n,1) sample2= randn(n,1) sample1 = 0.3481 0.2328 0.6735 -0.1274 -0.4146 sample2 = -1.4964 -0.7325 -1.0193 -0.6829 -0.4427 我想要 sample1 = 0.3481 -1 0.2328 -1 0.6735 -1 -0.1274 -1 -0.4146 -1 sample2 = -1.4964 1 -0.7325 1 -1.0193 1 -0.6829 1 -0.4427 1 并在矩阵中包含所有数据: data= 0.3481 -1 0.2328 -1 0.6735 -1 -0.1274 -1 -0.4146 -1 -1.4964 1 -0.7325 1 -1.0193 1 -0.6829 1 -0.4427 1 How to do this? [B]回答:[/B] 尝试这个: n=5; sample1=[randn(n,1) -1*ones(n,1)]; sample2=[randn(n,1) ones(n,1)]; data=[sample1; sample2]; [url=https://stackoverflow.com/questions/5380111]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 23:18。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.