MATLAB Answers

Generating vector and made it variable

3 ビュー (過去 30 日間)
sarah tariq
sarah tariq 2019 年 10 月 17 日
コメント済み: sarah tariq 2019 年 10 月 22 日
How i could generate a vector of equally likely 1 and -1 values and this vector has more than 1000 values. i want to make this vector variable that can be modified in the begining of the script
x = -1 : 0.001 : 1;

  0 件のコメント

サインイン to comment.

回答 (1 件)

Steven Lord
Steven Lord 2019 年 10 月 17 日
Do you want exactly the same number of +1 and -1 values or do you just want each element to have an equal probability of being +1 or -1? For the former, make a vector that has the correct number of +1 and -1 elements (not randomly arranged) then use the output from randperm to shuffle it. For the latter, use randi to make a vector of 1's and 2's then replace all the 2's with -1.

  1 件のコメント

sarah tariq
sarah tariq 2019 年 10 月 22 日
what would be the syntex then? these -1 and 1 values represent the signal part the question is : Generate a vector x of equally likely 1 and -1 values. The vactor should be long typically more than 1000 values. Assume the -1 and 1 values represent the signal part of what we received after optimal sampling in our matched filter ( the signal energy). Generate a vector n of zero mean Guassian distributed random variables of the same length as our received signal vector. Plot the pgf of the sum y = x + n when the Gaussian distribution has a standard deviation such that SNR is 3db

サインイン to comment.

サインイン してこの質問に回答します。


Translated by