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 Feb 29, 2020, 2:23 a.m. EST

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Feb 28, 2020, 7:20 a.m. EST

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 Feb 28, 2020, 7:55 a.m. EST

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 Feb 28, 2020, 8:17 a.m. EST

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 Feb 29, 2020, 2:23 a.m. EST

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.