Use a for loop inside a vector
古いコメントを表示
The first part was to make a rectangle vector and the second part is to make a curve vector that uses the data from the recktangle and adds a signal with the maximum amplitude noise. I got the first part down, so, I'm trying to get a vector with a for loop inside of it. What I have for now:
curve= [];
for i=1:numel(recktangle)
recktangle(i) = recktangle(i) + (rand() * noise);
end
curve= curve(:);
but it says that curve seems to be unused. How do I nest a for loop in an array?
4 件のコメント
KL
2017 年 11 月 16 日
what exactly are rectangle vector and curve vector?
M
2017 年 11 月 16 日
You never update the value of curve except at the end where you last line says "curve remains an empty array".
I guess you have to update curve inside your for loop.
Una Ib
2017 年 11 月 16 日
KL
2017 年 11 月 16 日
...First vector has a random number of zeros the second has a random number of ones...
what are the sizes? Please be specific and give a complete explanation. It's always better to create a sample input and expected output.
as far as your explanation on curve vector goes, my answer does exactly that.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Uniform Distribution (Continuous) についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!