Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline tomtit  
#1 Posted : 08 March 2022 21:46:17(UTC)
tomtit


Rank: Advanced Member

Groups: Registered
Joined: 22/02/2014(UTC)
Posts: 81

Was thanked: 11 time(s) in 10 post(s)
test_Cnd.sm (8kb) downloaded 10 time(s).

The strange problem happens during symbolic evaluation of the function
Cnd.
The expression ii=rows(t) was interpreted in a wrong way.
If I replace "ii" with number 2 the worksheet works fine.
The result of rows(t) is correct and equal to 2.
You can check the behavior changing the condition in "if" operator to 0 or 1.

Edited by user 08 March 2022 21:50:08(UTC)  | Reason: Not specified

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Razonar  
#2 Posted : 09 March 2022 03:46:24(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi. Notice that the degree of the numerator polynomial is not always equal to the degree of the denominator polynomial. Also the number of rows in rows(tt) for tt=numden(H(z)) is always going to equal two, and is not related to the degree of none of the previous polynomials.

I think what you have to do is create separate loops for numerator and denominator, and you can get the degree of the polynomials in this way:

img.jpg


Finally, you can create the loop in the range ii..0 instead of 0..ii and thus avoid having to use reverse(), which the SMath token processor sometimes doesn't like.

Best regards.
Alvaro.
thanks 1 user thanked Razonar for this useful post.
on 09/03/2022(UTC)
Offline tomtit  
#3 Posted : 09 March 2022 17:30:07(UTC)
tomtit


Rank: Advanced Member

Groups: Registered
Joined: 22/02/2014(UTC)
Posts: 81

Was thanked: 11 time(s) in 10 post(s)
Hi Alvaro,
The worksheet is correct, the transfer function presented is from a real working project (digital PFC controller).
If the requested coefficient doesn't exist maple(coeff()) returns 0. I think it is correct behavior.

Sorry, I posted the report in a rush, so it might need more clarification.
The problem is that variable ii has correct value =2, you can check it easily.
If you manually set the loop range [0..2] - the worksheet works, but with the loop range [0..ii] - fails.
I have no reasonable explanation rather than a bug.

Offline Razonar  
#4 Posted : 09 March 2022 20:28:24(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: tomtit Go to Quoted Post
... The problem is that variable ii has correct value =2, you can check it easily.
If you manually set the loop range [0..2] - the worksheet works, but with the loop range [0..ii] - fails.
I have no reasonable explanation rather than a bug.


Hi. Yes, same thing here, where SMath cannot evaluate rows():

https://en.smath.com/for...-Analysis.aspx#post69034

Best regards
Alvaro.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.