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 JReg  
#1 Posted : 08 July 2023 08:43:26(UTC)
JReg


Rank: Advanced Member

Groups: Registered
Joined: 03/06/2023(UTC)
Posts: 45
Man
United States

Was thanked: 1 time(s) in 1 post(s)
My Mathcad brain causes me to misunderstand some SMATH syntax. The is especially true in XY-Plots. I have created two function: F(s) and F1(s), which is discontinuous. If I redefine the functions as vectors and use augment to define the x-axis, the plots look okay. However, when I try to plot just the function, it does not work. These plots do not create a trace list as with the vector versions. F(s) just doesn’t plot. F1(s) also doesn’t plot, plus it gives an error.

In short, how do I plot simple functions?

Any help is appreciate, as always.


Plot Functions Question.sm (13kb) downloaded 8 time(s).
Reg Curry
Loveland, CO

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

Offline Razonar  
#2 Posted : 08 July 2023 09:33:26(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 JReg. If I'm not wrong, just try to plot both with an undefined variable like F(so) and F1(so). The problem is that 's' is a vector.

Best regards.
Offline JReg  
#3 Posted : 08 July 2023 13:28:35(UTC)
JReg


Rank: Advanced Member

Groups: Registered
Joined: 03/06/2023(UTC)
Posts: 45
Man
United States

Was thanked: 1 time(s) in 1 post(s)
Razonar,
Thanks much. That works.

Hope you don't mind if I have a second question.

In this attached sm file, I calculate the solution to an ODE with those two driving functions. Note the last integral in the solution. If I use F(s) it works; however, F1(s) is the function I want in the integral. For some reason it does not work. You will have to change F to F1 in that last integral to see that it fails.

Have I missed something obvious?

Thanks again. EMISSION REDUCTION Test.sm (29kb) downloaded 13 time(s).
Reg Curry
Loveland, CO
Offline StvMath  
#4 Posted : 08 July 2023 16:39:50(UTC)
StvMath


Rank: Advanced Member

Groups: Registered
Joined: 26/07/2022(UTC)
Posts: 35
United Kingdom
Location: UK

Was thanked: 22 time(s) in 19 post(s)
It works if you define F1 as: F1(z):=(M*(z-tstart)+Fexp(tstart))*(z≤tfinish)+Fexp(tfix)*(z>tfinish)

i.e. using Boolean values: (z≤tfinish) = 1 if true, 0 if false, etc.

Don't know why SMath has a problem integrating if.. else.. structures.
Offline JReg  
#5 Posted : 08 July 2023 19:45:07(UTC)
JReg


Rank: Advanced Member

Groups: Registered
Joined: 03/06/2023(UTC)
Posts: 45
Man
United States

Was thanked: 1 time(s) in 1 post(s)
Thanks. I’ll give that a try.
Reg Curry
Loveland, CO
Offline JReg  
#6 Posted : 08 July 2023 21:56:23(UTC)
JReg


Rank: Advanced Member

Groups: Registered
Joined: 03/06/2023(UTC)
Posts: 45
Man
United States

Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: StvMath Go to Quoted Post
It works if you define F1 as: F1(z):=(M*(z-tstart)+Fexp(tstart))*(z≤tfinish)+Fexp(tfix)*(z>tfinish)

i.e. using Boolean values: (z≤tfinish) = 1 if true, 0 if false, etc.

Don't know why SMath has a problem integrating if.. else.. structures.


Thanks again. That really helped.

Reg Curry
Loveland, CO
Offline Jean Giraud  
#7 Posted : 09 July 2023 13:45:20(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: StvMath Go to Quoted Post
Don't know why SMath has a problem integrating if.. else.. structures.

Smath integrates if/otherwise discontinuous functions.
Bolean must be specified completely, if NOT navigates.

Integrate Discontinuous.sm (37kb) downloaded 8 time(s).
Offline uni  
#8 Posted : 10 July 2023 10:22:25(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Due to the implementation features, you can't use the function argument the same way you do it in Mathcad. The component allows you to use a vector variable if you add a tilde before the name.

xyplot-tilda.png

Plot Functions Question (uni).sm (15kb) downloaded 9 time(s).
Russia ☭ forever
Viacheslav N. Mezentsev
Users browsing this topic
Guest
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.