Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

How to create a finite set of numbers

Please login with a confirmed email address before reporting spam

Hello,

I would like to use as parameters a set of (random) numbers. The random part is easy once you have a set of numbers, but it seems that you can only define scalar parameters. Is there a way to do this, or a workaround?

Thanks for your help,

Leo


4 Replies Last Post 2020年2月29日 GMT-5 02:23

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2020年2月28日 GMT-5 07:20

I am also interested to know if you think this is not possible, and why

I am also interested to know if you think this is not possible, and why

Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2020年2月28日 GMT-5 07:55

Hi,

If I understand your question correct, you can just use a parametric sweep like random(range(1,1,1000)).

Se attached screenshot.

-------------------
Henrik Sönnerlind
COMSOL
Hi, If I understand your question correct, you can just use a parametric sweep like random(range(1,1,1000)). Se attached screenshot.


Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2020年2月28日 GMT-5 08:17

Hi, Thanks for your answer. I don't think that works in my case, because I need this set of numbers for a single simulation. If I understand correctly this will generate a random number for each simulation. Maybe more context helps: I want to make step-like variations of a quantity, with different step lengths, and the set of numbers would set the boundaries of this steps in space.

Hi, Thanks for your answer. I don't think that works in my case, because I need this set of numbers for a single simulation. If I understand correctly this will generate a random number for each simulation. Maybe more context helps: I want to make step-like variations of a quantity, with different step lengths, and the set of numbers would set the boundaries of this steps in space.

Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2020年2月29日 GMT-5 02:23

In that case, I think it is easiest to define your input using a piecewise function where the intervals are random. The table in the function can for example be populated using a model method or by importing a table in created in Excel.

-------------------
Henrik Sönnerlind
COMSOL
In that case, I think it is easiest to define your input using a piecewise function where the intervals are random. The table in the function can for example be populated using a model method or by importing a table in created in Excel.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.