Monte Carlo Uncertainty Analysis for SimMechanics Model
3 次查看(过去 30 天)
显示 更早的评论
I have a multibody SimMechanics model (4.0 1st Gen) that descibes the motion of the head/cervical spine from a blunt impact to the back. I would like to perform an uncertainty analysis by using a vector (1000+ elements) of values for some of the model parameters (e.g., head mass). The model should run with one set of input parameters, generate the output, then receive a new set of input parameters, and so on. Any suggestions would be helpful. If more info is needed please ask.
0 个评论
回答(1 个)
Ryan G
2012-7-3
编辑:Ryan G
2012-8-13
This should be relatively straightforward. I'll try to break this down in steps so you can apply this to your application.
1) Define the blocks/signals that will be varied and how. For simmechanics you may want to vary the mass of a body, you will either need a parameter in the Mass to vary or know the block name so you can vary it using set_param. Same applies for gains, constants and other simmechanics blocks.
2) Create a set of varied parameters to utilize. It would probably also be useful to store them so you can better analyze your results. you can use a command like
variationMethod = 'norm'
defaultMass = 1;
variation = 0.1;
Variations.MassBody1 = random(variationMethod,defaultMass,variation,[1,1000]);
This will create 1000 normally distributed variations from the mean, but only you will know what the method and variation should be.
3) In a for loop (preferably PARFOR) change the parameter in the block and simulate for each step. For example:
for i = 1:1000
set_param('system/Body1_name','Mass',num2str(Variations.MassBody1(i)));
simOut = sim('system');
dataMC(i) = simOut;
end
However, it would be up to you how to store the data and run the analysis and there is no definitive right way.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!