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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Problem with coding.

mzarrabi
13-Aquamarine

Problem with coding.

Hi everybody,

I am new in coding with the Mathcad. I am trying to code a model related to civil engineering (geotechnical engineering), but I have faced several problems. I think the problem is not that much hard, but I couldn't solve it. I wonder If somebody could take a look at it and give me some hints about that. I have attached my file as well as the picture of what I am trying to code.

Thanks in advance.

10 REPLIES 10
LucMeekes
23-Emerald III
(To:mzarrabi)

You're using a variable eta with a subscript i-1. This means that eta must be defined AND must be an array.

Well eta is defined, and is an array PROVIDED that the if-statement (at the top of above picture) is true. Apparently that is not (always) the case.

Either make sure that the if-statement is executed, or provide some other way of generating the eta array, or find a way to execute the 'otherwise' without needing the eta array.

Success!

Luc

-MFra-
21-Topaz II
(To:mzarrabi)

Hi,

problem with coding.jpg

mzarrabi
13-Aquamarine
(To:-MFra-)

Thank you LucMeekes‌ and F.M.‌,

It was great. I modified my code a little bit, and I faced another problem. It says: " Found a number with a magnitude greater than 10^307 while trying to evaluate this expression." How can I deal with that?

H Problem.PNG

LucMeekes
23-Emerald III
(To:mzarrabi)

You're raising e to the power n.d times psi. either n.d or psi, or their product is too big.

Success!

Luc

-MFra-
21-Topaz II
(To:mzarrabi)

Dafalias.jpg

mzarrabi
13-Aquamarine
(To:-MFra-)

So, what should do to avoid such a situation.

LucMeekes
23-Emerald III
(To:mzarrabi)

Find out why such values result.

By examing the model and/or your program.

Success!
Luc

-MFra-
21-Topaz II
(To:mzarrabi)

complex values source.jpg

hence p must not assume negative values!!

What to do for this not to happen? this task is yours !!

mzarrabi
13-Aquamarine
(To:-MFra-)

Thank you again F.M. and LucMeekes for your valuable comments,

I modified my model a little bit more. Now, my model initially goes well, but later it shows spikes that I cannot find out why?

Spikes.png

-MFra-
21-Topaz II
(To:mzarrabi)

Before continuing, I would recommend you to use the units of measure for all physical quantities present in the worksheet, both constant and variable. In this way they are highlighted inconsistencies that, without such use, would not appear.

Announcements

Top Tags