Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
need to find q1 which is basically the values of qcza( known variable) qcza is the resistance in known depth [z].
q1 is equal to qcza when the depth is between 0.7D<z< 4D when D=0.4 and it has always to choose the minimum value until there is smaller value. the file is attached
Solved! Go to Solution.
So lets see if this next try comes closer to what you have in mind ...
Prime 9 file attached
Its not perfectly clear to me what you are looking for.
As I understood:
1) Input value is a length D (in your example 0.4 m)
2) a range is calculated running from 0.7*D up to 4*D (in your example 0.28 m up to 1,6 m)
3) We look up all the q-values corrsponding to the range calculated in #2 and select the smallest of them
In your example the output would be 2.22 MPa (which by chance happens to be at the upper end of the interval. Is this correct?
Or should we chose the q-value corresponding to the smallest z-value (-> 5.721 MPa, first value in interval)?
OR ...?
BTW, your data looks a bit ... erratic, doesn't it?
Here is how I would implement the algorithm described above - as a function with D as input and the q-value as output.
Prime 9 worksheet attached
@YA_10963798 wrote:
The input values are z and qcza
No! z and qcza are the data vectors for length and pressure (you call it depth and resistance, but I don't care about the meaning of the data).
The input seems to be a single length/depth Db. You provided 0.4 m as an example
Its still not clear what the output, the result, should be. I assumed it to be a single pressure value (as described above) but I can't be sure. You did not answer my question if the result of the input value D.b=0,4m really should be 2,22 MPa. If not, what else should the result be and why?
Now q1 is equal to qcza when z is between (0.2<z<1.4)
q1? q1 is the desired result, the output. But how could q1 be equal to qcza??? qcza is a vector with 1339 entries!
I need to write a program showing the values of q1 as a rangeConsidering that q1 should be always small when going deeper .For example if qcza is equal to = 7 /8 /6/7/9The program should choose q1 as q1= 7/ 7/6/ 6Always goes with the smaller numberI hope you get it
The leaves me clueless, sorry!
Actually q1 should be also a vector
qcza is group of values in certain depths and I will have to find q1 , q2 and q 3 which are three smaller groups of values in the main group qcza.
q1 is equal qcza in the depth 0.2 and 1.4
and q 2 is equal to qcza in the depth 1.4 and 2.8
However qcza values are random while specifying the range of q1 I need the program to choose the smaller values when it goes down in depth z
> The program should choose q1 as q1= 7/ 7/6/ 6
Shouldn't there be a fifth value 6 at the end?
You always talk about q1 and now q2, q3 without saying what q2, q3 should be.
As I understood so far now every input value Db should return a vector of pressure values where each value is either equal or lower than the previous?
In case thats what you want, - do you also need the corresponding subvector of z-values? Or is all you need the vector q1?
So lets see if this next try comes closer to what you have in mind ...
Prime 9 file attached
wow that's impressive
I will try it thank you so much for your great help
If you feel uncomfortable with using "match" and "submatrix", here is a version which may be clearer to read and follow. The result is the same of course
it works thank you so much. I made some changes but your solution was impressive. If you have time you should have a Youtube channel you are a great teacher . Once again thank you
Its a bit lengthier if you also need the the corresponding z-value
Prime 9 sheet attached
Thank you so much I will try it
@YA_10963798 wrote:
Thank you so much I will try it
Hope it helps.
I had not read your second posting (which I have to admit did not understand) when I posted the sheet. So the routine just follows what I had outlined.