Problem iterating

Problem iterating - Сообщения

#1 Опубликовано: 01.05.2020 04:37:12
Pablo001

Pablo001

0 сообщений из 5 понравились пользователям.

Группа: User

Dear all,

Thanks for your great help!!

In this sample, when I iterate to find θ, I have no problem at the first time.
test.sm (28 КиБ) скачан 36 раз(а).

Then, when I want to calculate SM matrix, something goes wrong:
- Do you know what is the problem?
- The expression to find θ and SM is the same. Could I use only one expression to calculate these 2 variables?

Then, if y change Cm coefficients in order to find a new θ value, the expression don't work,
- I'm lost


Some feedback?? Thanks in advance!
#2 Опубликовано: 01.05.2020 06:49:48
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Wrote

Dear all,

Then, when I want to calculate SM matrix, something goes wrong:
- Do you know what is the problem?
- The expression to find θ and SM is the same. Could I use only one expression to calculate these 2 variables?



Hi. Actually I can't find why your code don't works, it looks fine to me. But, some problem have, because the error message. About to use only one expression for both, I guess that this is the solution:

Clipboard07.jpg

Hope this helps.
Best regards.
Alvaro.
#3 Опубликовано: 01.05.2020 07:10:54
haweHofmann

haweHofmann

3 сообщений из 32 понравились пользователям.

Группа: User

Wrote

Dear all,
Then, if y change Cm coefficients in order to find a new θ value, the expression don't work,
- I'm lost




Your first calulation block return theta AND assin it to theta - if your block has finished you have calculated matrizes theta, MM, SM it is not necessary to assin theta again

I think you made a endless loop in the 2. block
make assinments to theta and SM return SM and assign it to itself. Removing the assinment of the blocks.

BTW. what is the difference in calculation SM in 2. block to the one in 1. block?
seems to me SM is ident in both cases


From Newby to Newby ;-)

Start Debugger
1. mark code line
2. set breakpoint
3. start debugger F11
4. continue to breakpoint
5. copy to empty page (better to a 2. instance runing) to examine what you have


SMathDebug_2020-05-01_12-13-52.jpg
2 пользователям понравился этот пост
Davide Carpi 01.05.2020 08:58:00, frapuano 01.05.2020 14:07:00
#4 Опубликовано: 01.05.2020 08:58:26
Davide Carpi

Davide Carpi

1416 сообщений из 2873 понравились пользователям.

Группа: Moderator

The error happens because inside the SM procedure (it's a procedure when line is used on the RHS of a variable) you are trying to assign a matrix element to an existing scalar (Θ, defined in the procedure right above). To avoid it, you should initialize the nested variables before using them, f.e. using
Θ:matrix(rows, columns)
or
 Clear(θ,...)


If the existing variable θ was already a matrix, you would have ended overwriting the original values without warnings. This is a powerful feature of the program but if you are not aware of it you might end with some crazy results.

In general when you are inside a function or a procedure it's a good practice to always initialize the variables that are meant to be "local"; if you want to inherit a variable and change his value(s) only locally you have to assign it to a local variable. Obviously it can be avoided, if you are aware of the behaviors and you are sure there won't be any accidental inheritance/interference in the worksheet, like for small examples and such.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#5 Опубликовано: 01.05.2020 10:23:12
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

Then, if y change Cm coefficients in order to find a new θ value, the expression don't work,
- I'm lost


Best never used the consumed variables
Your 3 data sets from doctored ?

test (4 try this).sm (36 КиБ) скачан 32 раз(а).

#6 Опубликовано: 01.05.2020 14:37:52
Pablo001

Pablo001

0 сообщений из 5 понравились пользователям.

Группа: User

Hi,

Thanks everyone for your help!
Understood, it's better to clear the matrix to re-use it.

Jean, your file shows black sentences in my computer.

Jean file
#7 Опубликовано: 01.05.2020 16:30:41
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

Jean, your file shows black sentences in my computer.


That's the mutual freak between 7251 6179 and vice versa.
Select all, background white.
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений