cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Translate the entire conversation x

Drawing graphs in mathcad and finding the average

YA_10963798
14-Alexandrite

Drawing graphs in mathcad and finding the average

Hi there 

Can you help to reach a graph merged to the classification I have 

I have this graph 

YA_10963798_0-1763643288759.png

and I did a classification to the data in this graph ... what I need now is to merge the classification with the graph and make them obvious layers and then find the average in each layer 

YA_10963798_1-1763643391781.png

like this 

YA_10963798_2-1763643612555.png

By obvious layers I mean > a program wil be able to say from z1 to z50 >> it is a sand layer and the average Q in that layer is 10 MPa ( as an example) 

Is that possible ? 

Thank you in advance .. the sheet is attached 

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:YA_10963798)

So it looks that I was wrong when I counted 14 distinct layers. My program says there are 19.

As only layers with pressure above 25 MPa should be classified as "Grind" I classified layers with pressure below 0,1 MPa and pressures between 2 and 5 MPa as "undefined" as you didn't specify otherwise.

Furthermore as you did not say which class a pressure of exactly 0.2 MPa should be applied to, I have chosen "Clay".

Werner_E_0-1763657200090.png

So you may look for a table like this?

Werner_E_2-1763658175525.png

If had chosen to strip he unit for the average pressure because Prime unfortunately is not able to show MPa in the table and I considered the values in Pa to look too ugly and not clear enough.

Werner_E_3-1763658776089.png

 

 

View solution in original post

9 REPLIES 9
Werner_E
25-Diamond I
(To:YA_10963798)

I don't see why you function "Class" uses argument "d". Actually its just "Class(q)" as classification depends on pressure q only.

 

The way you write that function would mean that "Grind" actually is found in three intervals of pressure:  (0 MPa; 0.1 MPa), (2 MPa; 5MPa) and everything largen than 25 MPa. Is this really as it should be?

 

There is also a small discrepancy as 0.2 MPa would be "Peat" as well as "Clay". The way you wrote it, "Clay" wins in case q=0.2 MPa.

 

Your hand-drawn diagram looks as if the different classes are not only contiguous in terms of pressure, but also in terms of depth. However, this does not necessarily have to be the case (and is not, indeed), which raises the question of how it should be handles as, for example, “clay” occurs at a depth of -2.87 m to -3.1 m, but also from -5.63 m to 12.27 m, with “grind” occurring in between, from -3.1 m to -5.63 m.
Should the average value of both “clay” areas be given together, or should this be handled as two separate areas (which would be more complex)?

As far as I can see in your data there are six separated areas of "grind" (including (0,0) as a singular point). four separate areas of "sand", three separate areas of "clay" and no "peat" at all.

Werner_E_1-1763650983037.png

Using a log scale at the abscissa we can see better that there are no values in the range of 0.1 MPa to 0.2 MPa ("Peat"). Of course the singular "grind" point at (0,0) is not display as 0 would be at minus infinity at the abscissa 😉

Werner_E_0-1763651969911.png

 

 

  1. So which average values should be calculated? Or how many - four or fourteen?
  2. An where exactly should we draw the vertical lines representing the averages?
  3. And what should be returned as the 'average' of the non-existing "peat" section?

BTW, didn't we had a thread with a very similar question in the past? Maybe this one?

YA_10963798
14-Alexandrite
(To:Werner_E)

Hi Werner 

1) Grind should be only the values above 25 MPa < so I guess I wrote it wrong

2)

For the average value >  you said : for example, “clay” occurs at a depth of -2.87 m to -3.1 m, but also from -5.63 m to 12.27 m, with “grind” occurring in between, from -3.1 m to -5.63 m.>>> what I need to do in this layer where clay accours is to define these depths , and say from -2.87m to -3.1m the average q is 0.3 MPa ( by using average function for that specific layer) 

and then do the same for the following layer >>> so it repeats itself whenever the classification changes. 

see the yallow lines :  so instead of having so many qc in each layer I need only the average value . 

YA_10963798_0-1763654876386.png

I need to generate a table or matrices or what so ever showing where the layer starts and ends and what is average q in that layer. 

 

3)And what should be returned as the 'average' of the non-existing "peat" section? It can be (NAN) 

 

BTW it is not the same thread > previously in the calculation I already have the depths and the layers specified in a table ; this one 

YA_10963798_2-1763655285459.png

I knew where the layer starts and ends and we match the depths from CPT ( z) with the depths of the layer : 

YA_10963798_3-1763655408143.png

 

YA_10963798_4-1763655433654.png

Now I need to specify the layer and generate a table from there 

 

Thank you so much for your help . As always amazing 

Yusra

 

 

Werner_E
25-Diamond I
(To:YA_10963798)

So it looks that I was wrong when I counted 14 distinct layers. My program says there are 19.

As only layers with pressure above 25 MPa should be classified as "Grind" I classified layers with pressure below 0,1 MPa and pressures between 2 and 5 MPa as "undefined" as you didn't specify otherwise.

Furthermore as you did not say which class a pressure of exactly 0.2 MPa should be applied to, I have chosen "Clay".

Werner_E_0-1763657200090.png

So you may look for a table like this?

Werner_E_2-1763658175525.png

If had chosen to strip he unit for the average pressure because Prime unfortunately is not able to show MPa in the table and I considered the values in Pa to look too ugly and not clear enough.

Werner_E_3-1763658776089.png

 

 

YA_10963798
14-Alexandrite
(To:Werner_E)

I think you are the best person I have ever not met in my life. Thank you soooooooooooooooo much that exactly what I need 

 

Werner_E
25-Diamond I
(To:YA_10963798)

Notice that I edited my answer above while you were answering and added the pot of the average values.

YA_10963798
14-Alexandrite
(To:Werner_E)

Hi Werner

 

Do you know why I'm having this error > I changed the origin to be 1 and it works with all the function except for R > it says it has to be function. The only differecnce between yours and mijn is the origin 

YA_10963798_0-1763716136373.png

I tried to fix it ..but this happens 

YA_10963798_0-1763729747160.png

 

and I also want to get the q- averg alone > is not the method to do that is to put matrix index 

YA_10963798_0-1763717131628.png

 

Thanks

 

 

 

 

Werner_E
25-Diamond I
(To:YA_10963798)

1) You have to replace both R<rows(R)> with R<O+rows(R)> as it looks you defined   O <-- ORIGIN   somewhere at the top

 

2) The output of "getLayers" is a 19x8 matrix, not a vector. To get the column with the averages you have to use the column selector (Ctrl+Shift+C), not the vector index.

YA_10963798
14-Alexandrite
(To:Werner_E)

Great that works 

Although I don't know how it works , but it works .

Thanks 

Werner_E
25-Diamond I
(To:YA_10963798)

Prime unfortunately does not provide an empty array as data type. So it can be a bit tricky/annoying to initialize a matrix which is created row by row. It would be natural to use R<-stack(R,[...]) in a loop but this only works if R is already existing with the correct number of columns. So the first row must be created in a different way, usually requiring some kind of  if rows(R)=0 then R<- [...] else R<-stack(R,[...]).

rows(R) returns 0 for a variable which is a scalar or which is not yet defined in the program. So  R<rows(R)> (with <...> meaning the row selector, not the column selector) denotes row number 0. In case you changed ORIGIN from 0 to something else there is no row #0 and the first row rather has the number ORIGIN.

When the program continues and the matrix R already contains one row, rows(R) returns 1 and ORIGIN+1 is the number of the next row to assign.

 

Announcements

Top Tags