Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

Standard deviation over a data set

Please login with a confirmed email address before reporting spam

Hello Forum,

Is there an easier method to calculate the standard variation of a variable (e.g., flow velocity) over a predefined data set (e.g., a cut plane or a cut line) rather than importing the data to MATLAB? I can't find anything and I am surprised that COMSOL doesn't have such a basic capability!

Thanks for your input!

Hadi



1 Reply Last Post 04.11.2013, 03:16 GMT-5
Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 04.11.2013, 03:16 GMT-5
Hello,

There is no predefined operation for computing the standard deviation over a data set, but you can do it in COMSOL using the following steps:

1. Compute the average of the expression ("expr") for which you want to compute the standard deviation using a Line Average feature (under Results>Derived Values).
2. Copy and paste the numerical average value ("av") into the expression "(expr-av)^2" in another (or the same) Line Average feature (replace "av" with the numerical value computed in Step 1).
3. Compute the square root of the value computed in Step 2.

If you can define the line or plane of interest directly in the geometry, you can evaluate the standard deviation for a selection of geometric entities (a line, for example), where you define an Average coupling operator (aveop1, for example). Then use the expression

sqrt(aveop1((expr-aveop1(expr))^2))

for the standard deviation. We are looking into providing more direct support for computing the standard deviation in future versions of COMSOL.

Best regards,
Magnus Ringh, COMSOL
Hello, There is no predefined operation for computing the standard deviation over a data set, but you can do it in COMSOL using the following steps: 1. Compute the average of the expression ("expr") for which you want to compute the standard deviation using a Line Average feature (under Results>Derived Values). 2. Copy and paste the numerical average value ("av") into the expression "(expr-av)^2" in another (or the same) Line Average feature (replace "av" with the numerical value computed in Step 1). 3. Compute the square root of the value computed in Step 2. If you can define the line or plane of interest directly in the geometry, you can evaluate the standard deviation for a selection of geometric entities (a line, for example), where you define an Average coupling operator (aveop1, for example). Then use the expression sqrt(aveop1((expr-aveop1(expr))^2)) for the standard deviation. We are looking into providing more direct support for computing the standard deviation in future versions of COMSOL. Best regards, Magnus Ringh, COMSOL

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.