Continuous and repetitive gaussian random function in matlab
5 次查看(过去 30 天)
显示 更早的评论
I want to create a random rough surface profile as input form my method. I can able to create random variation in numbers using randn function but each time i simulate i get different input data which changes output. If it is possible to store and use the data or to generate a continuous function of random data which can be repetative if done simulaion that would be helpful
2 个评论
KALYAN ACHARJYA
2019-9-17
Hello Rakesh, can you show the plot you are looking for (use paint or any drawing tool)?
采纳的回答
Stephan
2019-9-17
If i understood you correctly, you want to get the same random values every time you run your code. This is reached by the rng function.
rand(1,10)
ans =
0.4387 0.3816 0.7655 0.7952 0.1869 0.4898 0.4456 0.6463 0.7094 0.7547
s = rng
s =
struct with fields:
Type: 'twister'
Seed: 0
State: [625×1 uint32]
rng(s)
rand(1,10)
ans =
0.2760 0.6797 0.6551 0.1626 0.1190 0.4984 0.9597 0.3404 0.5853 0.2238
rng(s)
rand(1,10)
ans =
0.2760 0.6797 0.6551 0.1626 0.1190 0.4984 0.9597 0.3404 0.5853 0.2238
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!