我是靠谱客的博主 花痴金针菇,这篇文章主要介绍thymeleaf随机数_使用MATLAB功能块在Simulink中生成随机数(Generating random numbers in Simulink with MATLAB function-b...,现在分享给大家,希望可以做个参考。

I've tried to both google this question and search among the questions and answers here, but I've found no definitve answer to my question so I'm making a new one. Hopefully it won't be too much trouble!

I'm creating a simulation in Simulink where I have a "MATLAB function"-block that is supposed to take input from another source (we can consider this source a "Constant"-block) and then apply a random number that is generated from the MATLAB function-block on the input.

My problem is that I get the exact same randomized numbers every single time I run the Simulink simulation. And I was wondering if someone could help me solve my problem?

Here is the code (not all of it, but all of it that matters):

% function MC_output = randomizer(Stat_input)

%#codegen minrand = 0.1;

maxrand = 1.9;

points = 10;

rand_numbers = Stat_input*minrand + rand(1, points).*(maxrand-minrand);

MC_output = mean(rand_numbers);

end

I've read about this solution:

coder.extrinsic('rng');

rng('shuffle');

I've used it in different ways but with no success. Some help would be greatly appriciated! Oh, and btw, I'm using MATLAB R2012a.

Thanks in advance, Niklas

最后

以上就是花痴金针菇最近收集整理的关于thymeleaf随机数_使用MATLAB功能块在Simulink中生成随机数(Generating random numbers in Simulink with MATLAB function-b...的全部内容,更多相关thymeleaf随机数_使用MATLAB功能块在Simulink中生成随机数(Generating内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(120)

评论列表共有 0 条评论

立即
投稿
返回
顶部