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 krugerdude  
#1 Posted : 28 May 2019 02:56:17(UTC)
krugerdude

Rank: Newbie

Groups: Registered
Joined: 28/05/2019(UTC)
Posts: 3
New Zealand

I'm having issues with using variables, I have a bunch of equations that have a single variable (end goal is to plot this) and when I use variable functions/matrices they make the outputs wrong somehow.
I have no issues when setting x to be a single number, but when I set x to a range of numbers the outputs go wrong.


https://imgur.com/a/B4Y8Sod


https://imgur.com/a/Qk3IxY8

Am I just doing it wrong?

Edited by user 28 May 2019 03:02:20(UTC)  | Reason: Fixing screen shots

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

Offline Jean Giraud  
#2 Posted : 28 May 2019 03:49:02(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: krugerdude Go to Quoted Post
I'm having issues with using variables, I have a bunch of equations that have a single variable (end goal is to plot this) and when I use variable functions/matrices they make the outputs wrong somehow.
I have no issues when setting x to be a single number, but when I set x to a range of numbers the outputs go wrong.

Please: attach the Smath work sheet to see what you may be missing.

Offline krugerdude  
#3 Posted : 28 May 2019 04:37:14(UTC)
krugerdude

Rank: Newbie

Groups: Registered
Joined: 28/05/2019(UTC)
Posts: 3
New Zealand

Smath Data Ranges.sm (695kb) downloaded 21 time(s).

Here is the smath file, the important parts are at the bottom.
Offline PompelmoTell  
#4 Posted : 28 May 2019 11:09:27(UTC)
PompelmoTell


Rank: Advanced Member

Groups: Registered
Joined: 23/12/2011(UTC)
Posts: 318
Man
Italy
Location: italy

Was thanked: 109 time(s) in 93 post(s)
you have to use the vectorize function
vectorize28-05-19.png

sergio
thanks 1 user thanked PompelmoTell for this useful post.
on 28/05/2019(UTC)
Offline Jean Giraud  
#5 Posted : 28 May 2019 15:33: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: krugerdude Go to Quoted Post
Here is the smath file, the important parts are at the bottom.

...added at the end of your document.

draw.PNG

Smath Data Ranges.sm (701kb) downloaded 7 time(s).
Offline krugerdude  
#6 Posted : 29 May 2019 05:26:56(UTC)
krugerdude

Rank: Newbie

Groups: Registered
Joined: 28/05/2019(UTC)
Posts: 3
New Zealand

Thanks for your help, the vectors did the trick (although I don't understand why they have to be vectors).

Here is the end result,

Capture1.GIF

Capture2.GIF
Offline PompelmoTell  
#7 Posted : 29 May 2019 11:41:53(UTC)
PompelmoTell


Rank: Advanced Member

Groups: Registered
Joined: 23/12/2011(UTC)
Posts: 318
Man
Italy
Location: italy

Was thanked: 109 time(s) in 93 post(s)
Obviously it's not a trick.
That way you ask to perform the evaluation element by element contained in the vector.
In the wrong way you used, perform the evaluation in a matrix sense (following the rules on matrix operations) because x1 is a matrix (vector).

sergio
Offline uni  
#8 Posted : 29 May 2019 15:52:57(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)
Another form. The arrow is a vector summation.

2019-05-29_17-53-49.png
Russia ☭ forever
Viacheslav N. Mezentsev
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.