Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

The same problem, different approaches - different results - HATE IT !

Status
Not open for further replies.

skjoex

Structural
Jul 17, 2007
82
Hi,

I created a piece of code, which automaticly return maximal internal forces from a file. Then I realized that I can simplify my code with built-in mathcad functions. So I created a new code but then I realize that results are different...I tried to set higher precision, but it did not work.
 
Replies continue below

Recommended for you

Would submatrix to extract numeric data followed by max / min functions do what you want?
 
What exactly are you trying to do, and what is the "correct" answer?

TTFN

FAQ731-376
 
ok, I was bit angry when I wrote this post and on the second sight I agree it can be unclear. So I simplified the file.

The code "MaxVnSily" search in fourth column of input table for absolute maximum. When maximum is found it return this maximum value but with real sign. In the same time some additional values are returned from the same row where maximum is found.

The second code should do the same thing with different approach, but I hope you can see clearly that value -8264.6 is not the same as -8263.6.

The funny and unlogical thing in the same time is that function min(F(4)) return correct value, but subsequently fuction match( min(F(4)), (F(4) ) return incorrect row index.
 
 http://files.engineering.com/getfile.aspx?folder=8247aafd-91d5-42a0-a0e1-917bc7d2d097&file=test2.xmcd
Just one question: where you show "Different Result", what is the value of "a"?
 
Yeah, two things:

> You use indices where you don't need to, so your first answer shows up in a nested array, which is unnecessary

> You seem to have forgotten that you stripped out the header in the submatrix and that b is offset by 6

> c does not need an index, again nested array as output


TTFN

FAQ731-376
 
...yes, thank you IRstuff.

In the second case I need to just set b+6 as in the first one case...Sometimes "I do not see things because of my eyes"

I wanted to use the external file directly (the table is actualy input as xls, only for this example I put it in the mathcad file to prevent uploading two files) without manual deleting of header so I came up whit this solution, but s from time to time I forgot my own logic.

Regarding unnesesary indexes, if you look to previous file I uploaded, maxVnSily returns more than one row of information. The reason of nested array is that I want to save vertical space in file so I try to write the information horizontaly as much as possible.

Ok, thank you again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor