Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
How to solve this , the result should have the same values in z and qcza...
Why Qcpt has different quantities it should have more than (6X1) l...ike the one in z and qcza
Solved! Go to Solution.
If you make the changes I had shown and replace the wrong q.... you should get a result and your expression for Q.CPT should be a vector with 5 (not 6 because your range i.n runs only from 1 to 5) large vectors.
Did you notice the remarks i made at the end of my last answer?
Any value between 12 MPa and 15 MPa would be set to zero. If thats not your intention but you rater want that value to be unchanged, you cold add the green highlighted statement.
The result vectors still will have one element less than the input and its first element will always be zero because q[1 never gets assigned a value.
Maybe its an option for you not to use the range i.n at all and use vectorization. That way all six vectors in q...anchors are used and not only the first five.
Your program uses a loop running from O+1 to last(z).
ORIGIN is set to 1 and z is a vector with just six(!!) elements (each of them is a larger vector).
So the loop is just run 5 times and the result is a vector with just six elements, the first one is never defined and defaults to zero.
Here an example:
if you may have noticed that z is a matrics contains 6 matrics
I want to write a program for each matrics is z
Like the first row in z is a matric (1339X1) I want the function to be applied in all of them.
@YA_10963798 wrote:
if you may have noticed that z is a matrics contains 6 matrics
I want to write a program for each matrics is z
Like the first row in z is a matric (1339X1) I want the function to be applied in all of them.
Which function?
I don't see any function which could be applied to a 1338 element vector.
You could make the yellow highlighted change but then the function would fail because of the usage of the green highlighted q.cza which only has 35 elements.
You may also reconsider the logic of your program. If both if-conditions fail, q.i is not assigned a value (and would default to zero). Is this really what you had in mind?
Furthermore, the result vector will now have one element less than the input vector and its first element will always be zero because it never gets a value assigned.
hmm I mistakenly wrote qcza it should be qcza;anchors in all of them . ( thanks for pointing that out)
I wrote funtion because I will be using the same operator in the following calculation.
What I need is to implement this program to all the data I inserted in (qcza;anchors) and z
not only for six times which is the number of rows in z but in all the rows values
If you make the changes I had shown and replace the wrong q.... you should get a result and your expression for Q.CPT should be a vector with 5 (not 6 because your range i.n runs only from 1 to 5) large vectors.
Did you notice the remarks i made at the end of my last answer?
Any value between 12 MPa and 15 MPa would be set to zero. If thats not your intention but you rater want that value to be unchanged, you cold add the green highlighted statement.
The result vectors still will have one element less than the input and its first element will always be zero because q[1 never gets assigned a value.
Maybe its an option for you not to use the range i.n at all and use vectorization. That way all six vectors in q...anchors are used and not only the first five.
it works . thank you
@YA_10963798 wrote:
it works . thank you
Sure, but I also hope that it calculates correctly - that the results are what they should be.
I am still concerned about the first value always being zero and the last one missing - but then maybe this does not matter at all.
Why I'm getting zeros;(
Because your function contains a loop that is executed for only ONE value of n, namely the index of the last element of this P..... vector.
Due to your picture (you should attach the worksheet!) I cannot see what the expression under the vectorisation is, but if it multiplies o with that element of array P... and with the variable thickness, then the result could very well be an array of elements all 0 (zero), because I suspect that o may be defined as 0.
Success!
Luc
You sure meant a loop like
For the rest, as Luc already said, we would need to see the current version of the sheet.
o is defined as 1.49 m in the originally posted sheet.
"thickness" is not defined there. I guess this is a single scalar and vectorization in the program would not be necessary.
I guess that your function F(..) could be written in a very simple way:
Note that the formal parameter of a function can have any name (I have chosen P for simplicity) - it must NOT be the very same name of the actual parameter used when you later call the function.
I wrote thickness
you will find it in last page
OK, so thickness is a nested vector as well. In this case your function F must have TWO arguments as otherwise there is no way to tell Prime which of the six vectors in "thickness" it should use.
One way to do so is (no vectorization in the program is needed as yu are just multiplying scalars):
But your function F still can be written simpler - this time vectorization is needed!
I see
Thank you so much