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 Tommy Svartvatn  
#1 Posted : 14 January 2021 16:36:02(UTC)
Tommy Svartvatn

Rank: Newbie

Groups: Registered
Joined: 14/01/2021(UTC)
Posts: 6
Norway
Location: Mo i Rana

Sample_1.PNGI can't get this to work properly. I have tested with just a simple function using x as variable, and it works. This will not!

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

Offline overlord  
#2 Posted : 14 January 2021 18:12:16(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,125
Turkey

Was thanked: 506 time(s) in 337 post(s)
Originally Posted by: Tommy Svartvatn Go to Quoted Post
I can't get this to work properly. I have tested with just a simple function using x as variable, and it works. This will not!

You are trying to plot with units.
I don't think it is possible or maybe I am wrong.
I could plot without units by the way.

Regards

2Dplot.png
Offline Jean Giraud  
#3 Posted : 14 January 2021 19:59:03(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Tommy Svartvatn Go to Quoted Post
I can't get this to work properly. I have tested with just a simple function using x as variable, and it works. This will not!

From the function you are trying to evaluate wrt scalar 'x',
give yourself two values of 'x', and their corresponding 'y' values
Then f(x):=linterp(X.Y,x) and plot f(x). linterp(,,,) ignores units
thus you have a clean plot free of units gyzmas.
Cheers ... Jean
Offline Tommy Svartvatn  
#4 Posted : 15 January 2021 13:45:28(UTC)
Tommy Svartvatn

Rank: Newbie

Groups: Registered
Joined: 14/01/2021(UTC)
Posts: 6
Norway
Location: Mo i Rana

Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: Tommy Svartvatn Go to Quoted Post
I can't get this to work properly. I have tested with just a simple function using x as variable, and it works. This will not!

From the function you are trying to evaluate wrt scalar 'x',
give yourself two values of 'x', and their corresponding 'y' values
Then f(x):=linterp(X.Y,x) and plot f(x). linterp(,,,) ignores units
thus you have a clean plot free of units gyzmas.
Cheers ... Jean


Thanks, Jean.

Can you show me an example?

Best Regards, Tommy
Offline Jean Giraud  
#5 Posted : 15 January 2021 16:48:47(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Tommy Svartvatn Go to Quoted Post
Can you show me an example?

... like this done 4 days ago.
In this one linterp(,,,) was just enough.
Eventually, you may have to collect more points for cinterp(,,,)
But check if cinterp(,,,) sterilizes units like linterp(,,,) ???
With cinterp(,,,) the "freak" factor may be more savant !
Does it work for your project ?
Cheers ... Jean

Integral (1) DoctoredRed (1).sm (38kb) downloaded 26 time(s).

Offline Tommy Svartvatn  
#6 Posted : 20 January 2021 16:50:50(UTC)
Tommy Svartvatn

Rank: Newbie

Groups: Registered
Joined: 14/01/2021(UTC)
Posts: 6
Norway
Location: Mo i Rana

It seems Smath can do plotting with units, just not my function from above. However, I am missing functionality on the 2D plot settings, adjusting the x-axis, y-axis etc.

Sample_2.PNG
Offline Jean Giraud  
#7 Posted : 20 January 2021 17:46:59(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Tommy Svartvatn Go to Quoted Post
It seems Smath can do plotting with units, just not my function from above

zoulou & Maya are pure decoration. Your unit system is not.

zoulou.PNG
Offline Tommy Svartvatn  
#8 Posted : 22 January 2021 14:31:25(UTC)
Tommy Svartvatn

Rank: Newbie

Groups: Registered
Joined: 14/01/2021(UTC)
Posts: 6
Norway
Location: Mo i Rana

Originally Posted by: Jean Giraud Go to Quoted Post

zoulou & Maya are pure decoration. Your unit system is not.

zoulou.PNG

I'm not quite sure I get that...
Offline Jean Giraud  
#9 Posted : 22 January 2021 16:47:07(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Tommy Svartvatn Go to Quoted Post
It seems Smath can do plotting with units, just not my function from above. However, I am missing functionality on the 2D plot settings, adjusting the x-axis, y-axis etc.

For the QuickPlot @ X, Y are adjusted by mouse wheel.
Shift+mouse wheel => X
Cntrl+mouse wheel => Y
Offline Tommy Svartvatn  
#10 Posted : 25 January 2021 15:23:26(UTC)
Tommy Svartvatn

Rank: Newbie

Groups: Registered
Joined: 14/01/2021(UTC)
Posts: 6
Norway
Location: Mo i Rana

Originally Posted by: Jean Giraud Go to Quoted Post

zoulou & Maya are pure decoration. Your unit system is not.

zoulou.PNG


Can you tell me exactly what you mean by this? I have tried plotting with m (meters) inside the function, but in my original function, it is not possible to plot with units...

Regards
Tommy
Offline Jean Giraud  
#11 Posted : 25 January 2021 16:12:34(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Tommy Svartvatn Go to Quoted Post
I have tried plotting with m (meters) inside the function, but in my original function, it is not possible to plot with units...

Is that what you mean: plot with units labels ?

PlotLabels.PNG

Offline Tommy Svartvatn  
#12 Posted : 25 January 2021 16:47:32(UTC)
Tommy Svartvatn

Rank: Newbie

Groups: Registered
Joined: 14/01/2021(UTC)
Posts: 6
Norway
Location: Mo i Rana

Originally Posted by: Jean Giraud Go to Quoted Post

Is that what you mean: plot with units labels ?

PlotLabels.PNG



I am simply trying to plot the function with N/m as unit, since I was able to plot with m as unit, I don't understand what the issue is.

Nice formatting by the way...
Offline Jean Giraud  
#13 Posted : 25 January 2021 17:30:46(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Tommy Svartvatn Go to Quoted Post
I am simply trying to plot the function with N/m as unit, since I was able to plot with m as unit, I don't understand what the issue is.

Curiosity or bug ... Units adepts, can you doctor that one ?
Offline Razonar  
#14 Posted : 26 January 2021 03:22:15(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: Jean Giraud Go to Quoted Post
Originally Posted by: Tommy Svartvatn Go to Quoted Post
I am simply trying to plot the function with N/m as unit, since I was able to plot with m as unit, I don't understand what the issue is.

Curiosity or bug ... Units adepts, can you doctor that one ?


Overlord has already published the correct answer about how to proceed to graph with units, but unfortunately I think that the user did not notice and was distracted by the other posts about ... I don't know about what they are.

Best regards.
Alvaro.
Offline fedeghi  
#15 Posted : 26 January 2021 10:17:15(UTC)
fedeghi


Rank: Advanced Member

Groups: Registered
Joined: 14/09/2013(UTC)
Posts: 90
Italy

Was thanked: 24 time(s) in 16 post(s)
Originally Posted by: Razonar Go to Quoted Post


Overlord has already published the correct answer about how to proceed to graph with units, but unfortunately I think that the user did not notice and was distracted by the other posts about ... I don't know about what they are.



Yes, first reply by Overlord has the answer Acute

From a general point of view, you can plot functions with units:
  • by restoring "x" units in the input of the graph, since X-Y plot is going to place unitless scalars where "x" is.
    If your function expected an input with units, and since X-Y plot will feed that input without units, that's why you need to multiply "x" with that proper unit.
  • by dividing the complete function with the expected output unit of measure, since X-Y plot will only accept values without units on y-axis, while the original function to be plotted is going to generate results with units.

At least, that's how I depicted it in my mind to remember what to do.

Consistent units with different magnitude will consistently scale your "x" and "y" axis.

Edited by user 26 January 2021 10:26:45(UTC)  | Reason: Not specified

Offline Jean Giraud  
#16 Posted : 26 January 2021 22:17:27(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: fedeghi Go to Quoted Post
Consistent units with different magnitude will consistently scale your "x" and "y" axis

... while observing the SI conversion kJ/mol =>J/mol.
Adapt the remaining of the project to suit: tabulate/plot.

Integral 0000000 Transit-Units.sm (23kb) downloaded 11 time(s).


Offline hanskl  
#17 Posted : 27 January 2021 17:52:07(UTC)
hanskl


Rank: Advanced Member

Groups: Registered
Joined: 25/10/2017(UTC)
Posts: 158
Norway

Was thanked: 7 time(s) in 5 post(s)
Sorry for necromancing an old resolved post.

SMath is often able to plot with units, but you have to tell SMath the unit you are plotting along the x-axis (mm vs. cm vs. m), and you have to understand SMath plots the values along the y-axis in the SI units (that's the only way it knows how to).

In your case, you have to zoom far out on the y-axis to see the results.

What I usually do is what overlord did, dividing the function (within 2D plot) by the desired unit to force the results I want.

Best regards,


2D plot with units.sm (8kb) downloaded 16 time(s).

2D plot with units.PNG
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.