Difference in plotting

Difference in plotting - One case requires x as independent vatiable the other accepts t. - Сообщения

#1 Опубликовано: 20.09.2012 19:18:21
Basile

Basile

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

Группа: User

Hello,

Does anybody knows why this difference in the independent variable?

Thank you,
Basile
Smath_01.JPG
#2 Опубликовано: 20.09.2012 20:23:37
Davide Carpi

Davide Carpi

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

Группа: Moderator

Wrote

Hello,

Does anybody knows why this difference in the independent variable?

Thank you,
Basile



Hi Basile,


I'm not sure but I think it's something related to "local" and "global" variables... using the line() [MATH]t[/MATH] becomes a local variable for [MATH]i(t)[/MATH], and the "global" [MATH]t:x[/MATH] doesn't affect the function, vice versa without the line() [MATH]t[/MATH] is a global variable for q(t) so plotting the graph you implicitly write "plot q(x)".


regards,

w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Опубликовано: 21.09.2012 08:54:32
Oscar Campo

Oscar Campo

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

Группа: Moderator

Hi Basile.
By default x is a global variable in SMath. When you define i(t), t is a local variable.
So, while you try plotting i(t) you get an error because t is not defined. When you define t=x, you obtain plots for i(t) and q(t)

Regards,

Oscar
#4 Опубликовано: 21.09.2012 09:40:06
Basile

Basile

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

Группа: User

Hello,

I can plot q(t) but not i(t) although I defined t:=x.

Can the definition of the functions have anything to do with that, one uses the if statement the other is as usually.

Regards,
Basile
#5 Опубликовано: 21.09.2012 11:49:29
Davide Carpi

Davide Carpi

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

Группа: Moderator

Wrote

Hello,

I can plot q(t) but not i(t) although I defined t:=x.

Can the definition of the functions have anything to do with that, one uses the if statement the other is as usually.

Regards,
Basile



You're right, the issue is in the if statement (see the attachments)

to bypass the issue use this workaround:

[MATH]i(t)t>0)*(4*sin(5*t))[/MATH]


regards,

w3b5urf3r
test.sm (8 КиБ) скачан 34 раз(а).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений