hyperstudy function

I want to get the X coordinate of maximum value with a graph,which function is available .thank you
Answers
-
Use file assistant for extracting responses. Refer attached video.
0 -
thank you very much
0 -
When defining output responses is it possible to determine the index of a specific value that isn't the minimum or maximum?
For example, I'm interested in knowing when the displacement of an element reaches a specific value that isn't necessarily the minimum/maximum, so the functions 'indexofmin' and 'indexofmax' aren't useful in this situation.
0 -
Autumn said:
When defining output responses is it possible to determine the index of a specific value that isn't the minimum or maximum?
For example, I'm interested in knowing when the displacement of an element reaches a specific value that isn't necessarily the minimum/maximum, so the functions 'indexofmin' and 'indexofmax' aren't useful in this situation.
(SOLUTION)
I was able to define two .py files and load them using a .mvw preferences file in HyperStudy to achieve this.
The first .py function found the value in the list closest to a specific value:
> def closest(list, val):
> return list[min(range(len(list)), key = lambda i: abs(list[i]-val))]The next .py function simply utilizes the index() function in Python:
> def indexofval(list, val):
> return list.index(val)I then created a .mvw preferences file following the steps outlined in HS-1040 being sure to use *RegisterPythonFunction in the file twice to properly load both functions.
Example: If I am then interested in finding the index of when the displacement of a node (list = disp) reaches 0.03 (=val) I can use the expression: "indexofval(disp, closest(disp, 0.03))". Since the displacement might not actually ever equal 0.03 exactly, I needed the "closest" function.
I also used the pre-defined function "getval2" to find other values (e.g. internal energy) associated with this specific displacement point. More information on these pre-defined functions in HyperStudy can be found in the HyperWorks online help page (HyperWorks Desktop Ref Guide > Templex & Math Ref Guide > Math Ref > Functions & Operators - AND - HyperWorks Desktop Ref Guide > Templex & Math Ref Guide > Templex Ref > Templex Statements)
0 -
Autumn said:
When defining output responses is it possible to determine the index of a specific value that isn't the minimum or maximum?
For example, I'm interested in knowing when the displacement of an element reaches a specific value that isn't necessarily the minimum/maximum, so the functions 'indexofmin' and 'indexofmax' aren't useful in this situation.
Hello,
I see your request without response along this thread.
The easiest way I see is to first identify the index of interest in the data source and then define a response to extract the value at this index. Fon instance in the example below the response is defined with Displacement value at index 6505.
Can this work in your case?
0 -
Diana M._20503 said:
Hello,
I see your request without response along this thread.
The easiest way I see is to first identify the index of interest in the data source and then define a response to extract the value at this index. Fon instance in the example below the response is defined with Displacement value at index 6505.
Can this work in your case?
Hello,
Thank you for this information. I ended up creating two functions using Python and uploading a preferences file to HyperStudy (details in my response above titled with "(SOLUTION)" for anyone interested). This approach you've outlined would work, it would just be quite tedious in my case as I'm looking for a specific value that may not be at the same index for each run and I have quite a number of runs.
I really appreciate your feedback!
0 -
Autumn said:
Hello,
Thank you for this information. I ended up creating two functions using Python and uploading a preferences file to HyperStudy (details in my response above titled with "(SOLUTION)" for anyone interested). This approach you've outlined would work, it would just be quite tedious in my case as I'm looking for a specific value that may not be at the same index for each run and I have quite a number of runs.
I really appreciate your feedback!
Thanks for sharing your solution!
For information, in HyperStudy 2021 there is a simpler way to register python function through the GUI.
2 -
Diana M._20503 said:
Thanks for sharing your solution!
For information, in HyperStudy 2021 there is a simpler way to register python function through the GUI.
Thank you for the tip!
0 -
Autumn said:
Thank you for the tip!
You are welcome.
0 -
Hello Automn,
let's say you have a stress vs plastic strain function for which you want to extract some information
You first need to create 2 data sources:
plastic strain, data source ds_1: {0 .1 .2 .3 .4 .5}
stress, data_source ds_2: {200 220 230 235 248}
let's say that you want the stress for plastic strain = .25, which is not available
You can then use lininterp command to get the value : lininterp(ds_1, ds_2, .25)
Best Regards,
Michael
0