# MatLab Subroutine Capabilities for Calculations

1 vue (au cours des 30 derniers jours)
Jay le 9 Mar 2018
Commenté : Jay le 11 Mar 2018
I would like to create a program and would like to know if MatLab can be programmed to do what I require.
If so, what is the best way to achieve the desired calculations that interact at different stages with one another.
Example Values:
Data Set 1
1.1 = 18.556732
1.2 = 25.433254
1.3 = 81.151712
1.4 = 96.304015
Data Set 2
2.1 = 18.556854
2.2 = 25.433242
2.3 = 81.152563
2.4 = 96.314000
Data Set 3
3.1 = 18.556844
3.2 = 25.433333
3.3 = 85.000000
3.4 = 96.313025
Desired Calculation:
Step 1 : Have the GUI ask the user the number of values in the first data set
- The user inputs 4
Step 2 : The GUI asks for the alphabetical level of precision required ("A", "B" or "C")
- The user inputs a letter
- That letter references conditions to be met and those conditions are assessed during the input of each data set.
Eg. The user inputs level "A"
Level "A" requires the following
1. - The running SD (the SD is recalculated during the run time) for each relative input (1.1, 2.1, 3.1, etc)<= 1.5 .
2. - The Maximum range between respective values of the datasets be <= 2
3. - The number of data sets required be >= 10.
This is required for every instance of a new data set of values.
##### 5 commentairesAfficher 3 commentaires plus anciensMasquer 3 commentaires plus anciens
Jay le 9 Mar 2018
I only object to other students using my code rather than putting the time and effort into the code writing process (not the general methodology).
Walter Roberson le 9 Mar 2018
Specifics are not code. Unless you have gone to the trouble of doing a complete functional breakdown with flow charts and careful interface definitions and data dictionaries and schemas, then your requirements probably do not need to be private.

Connectez-vous pour commenter.

### Réponse acceptée

Walter Roberson le 9 Mar 2018
Prompting for values is not difficult in MATLAB.
Generating random values according to specifications is not necessarily difficult, but a lot depends on the kinds of constraints needed. Some kinds of constraints can be a bit tricky to do fairly, such as generating a list of numbers fairly under the condition that the list sums to a particular fixed value. Fairly choosing random permutations of fixed sets can require some work when the set size gets large enough that the entire class of choices does not fit in memory.
##### 6 commentairesAfficher 4 commentaires plus anciensMasquer 4 commentaires plus anciens
Walter Roberson le 9 Mar 2018
Unzip this into a convenient directory and cd there in MATLAB. run the function named driver . This will give you a menu of options. script 1 is an example of a script calling a script. script 2 is a script called directly. function 1 is an example of a function calling a function. function 2 is an example of a function being called directly. function 3 is an example of a function calling a script (which is script 1, so it in turn invokes script 2).
Jay le 11 Mar 2018
Thank you for taking the time to write that up for me Walter.
It is greatly appreciated.
I will mark the post as answered and try to use the examples given to be used as subroutines.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by