Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
qc is determined in each z point . I need to find the average of qc in each layer . the layer thickness is dz
I need mathcad to find the average values of qc that correspond to dz values
Solved! Go to Solution.
Hi,
I am limited to Expresss so can only solve using subscripted vectors and matrices.
Enclosed is worksheet that gets the averages.
Cheers
Terry
Hi,
I am limited to Expresss so can only solve using subscripted vectors and matrices.
Enclosed is worksheet that gets the averages.
Cheers
Terry
thank you for your help
Why do you think I'm having this error although I just followed your sheet ?
Can you upload your worksheet.
Cheers
Terry
Hi,
If you have a full license for Prime the watermark will vanish.
Cheers
Terry
sure here you are you will find the calculation on page 9
Hi,
See enclosed it is now calculating averages.
Problem was z is previously designated as a nested matrix. Need to define z as a single vector.
Cheers
Terry
Hi Terry
I hope you are doing well . I know this very old question , I tried to use this function again , but I don't know why I'm getting errors. Can you help me to fix it > I couldn't upload the sheet > BTW it works in the other sheet ok.
The last five days the forum has problems with attachments. PTC admins are informed and according to Community Manager @AndrewK Khoros is working to fix the problem.
Its interesting that some people seem to have no problem uploading files, but others, like me and probably you, have problems doing so. I had success uploading a file in another thread after zipping it and uploading the zip archive.
I just tried here and experienced the same problem. Uploading the small mcdx file failed, but packing it in an archive is a possible workaround. It's annoying, but it works. I hope it won't be necessary to do this for much longer.
@AndrewK : Perhaps the problem and the workaround should be pointed out in “PTC Community Announcements”?
@YA_10963798 : According to your problem - you don't show what the error message is, but chances are its a "division by zero", right?
From your screenshot it looks like at least one value in your vector "ns" is zero (actually most elements in "ns" seem to be zero) and so its natural that you get an error if you use this vector in the denominator of the vectorized expression.
What did you expect from 0/0 (all elements but the first)?? What would you like to see as a result if the value in Sum is positive but the value in ns is zero (like 1/0)?
You could catch the error with "try...on error ..." and return a value of your choice (maybe 0, maybe NaN) in case the division fails. For example
And you sure will want to replace 12345 for something more meaningful 🙂
Hi Werner
Okay I hope they solve the problem as soon as possible . Actually what I was trying to do is to find the average of qc in each layer ( it is a problem you helped me with previously) I wanted to compare your method to Terry's method . but I got that error ( ns is divided by zero which is true .
Can you help me to fix the program you wrote it before for me : This is what you wrote from me
I made small changes : I changed ( Z) and q ... because an error appear ( that they should be vectors) and then change "It" to " near" .... However I got very strange values
It is strange because I am expecting only Qavg to be [12*1] not repeated as much as the number of z ... I hope you still remember this question when we first linked all the depths ( z) to the layer thickness (ztop) and then we found the average q in each layer .. it is the same , but now I try to do it only for one CPT and many .
Regards
Yusra
I don't remember about this program but if the failing program you show in your first pic ever worked OK, then "z" and "q.cza" must have been nested vectors.
Not they seem to be normal vectors consisting of scalars and so the program fails. You cannot expect a program to still work OK if you change the type of data structure of the input variables.
When, in your second picture, you use "z" and "qcza" instead of the now useless "Z" and "Q", you are actually doing the very same calculation 12 times (assuming that z consists of 12 elements) and so you get a nested vector consisting of 12 equal vectors.
You may remove the outer for-loop (the one with "i") and see if the result is now what you expect.
BTW, even though there are forum problems with attachments at the time, you still can attach your file if you put it in an archive (ZIP, RAR, ...) and attach this archive.
Ok I will try to do that , or I will just zip the file and upload it
Thanks
