1 страниц (14 вхождений)
Multiple lines on same graph - generated in a loop - Сообщения
#1 Опубликовано: 18.06.2014 13:12:18
Hello,
I am trying to plot multiple lines on the same graph. I understood in the plot region I can insert the "multiple values" placeholder and add the different functions to be plotted there.
But what if I want 100 functions to be plotted? Do I have to add all of them manually in the placeholders, or does this possibility exists in Smath Studio?
In matlab I would do something like
x=vector between 0 and pi
for i:0; i<100; i++
{
for j=0; j< length(x); j++
{
matrix(i,j)=i*sin(x);
}
plot(x,matrix(i))
}
Thank you
Marco
I am trying to plot multiple lines on the same graph. I understood in the plot region I can insert the "multiple values" placeholder and add the different functions to be plotted there.
But what if I want 100 functions to be plotted? Do I have to add all of them manually in the placeholders, or does this possibility exists in Smath Studio?
In matlab I would do something like
x=vector between 0 and pi
for i:0; i<100; i++
{
for j=0; j< length(x); j++
{
matrix(i,j)=i*sin(x);
}
plot(x,matrix(i))
}
Thank you
Marco
#2 Опубликовано: 18.06.2014 13:58:59
Hello Marco,
This is easy. Just use a linear indexing assignment on a system (Look at the attachment).
Best regards,
Davide
Multiple plots.sm (9 КиБ) скачан 50 раз(а).
This is easy. Just use a linear indexing assignment on a system (Look at the attachment).
Best regards,
Davide
Multiple plots.sm (9 КиБ) скачан 50 раз(а).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Опубликовано: 18.06.2014 14:20:01
grazieeeeee!!!
(thanks)
What if I want to plot with custom horizontal axis? that is building a specific horizontal axis vector?
what I am doing is clearly wrong
Marco
Multiple plots - wrong.sm (3 КиБ) скачан 37 раз(а).
(thanks)
What if I want to plot with custom horizontal axis? that is building a specific horizontal axis vector?
what I am doing is clearly wrong
Marco
Multiple plots - wrong.sm (3 КиБ) скачан 37 раз(а).
#4 Опубликовано: 18.06.2014 14:22:28
Di nulla (you're welcome) 
Updated with domains and matrices.
Davide

Updated with domains and matrices.
Davide
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#5 Опубликовано: 18.06.2014 14:28:33
just saw your editing...Thanks again
#6 Опубликовано: 18.06.2014 14:31:35
If you are interested on techniques to plot axis, you can see also this example made by oscampo
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#7 Опубликовано: 18.06.2014 14:45:46
thanks, I had the bode plot example. Didn't have time to try to understand it yet.
btw, how did you insert the range? What is the horizontal line and how do I get it? (I tried with the fraction "/" ... fail!)
btw, how did you insert the range? What is the horizontal line and how do I get it? (I tried with the fraction "/" ... fail!)
#8 Опубликовано: 18.06.2014 14:52:36
To have the range(2) function type range and press tab; to have he range(3)
function press the argument separator key inside a range(2) placeholder or select the range(3) function from the dynamic assistance.
To have the line(#) function type line and press tab, press the argument separator key to have more lines. You may also use the line button in the Programming palette on the right.
The number inside the parentheses is the arguments' number of the function (# means undefined)
![2014-06-18 20_52_42-SMath Studio Desktop - [Page1_].png](/ru-RU/file/WX3bh2/2014-06-18-20_52_42-SMath-Studio-Desktop---_Page1___png)
function press the argument separator key inside a range(2) placeholder or select the range(3) function from the dynamic assistance.
To have the line(#) function type line and press tab, press the argument separator key to have more lines. You may also use the line button in the Programming palette on the right.
The number inside the parentheses is the arguments' number of the function (# means undefined)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#9 Опубликовано: 18.06.2014 14:55:08
sorry I meant the domain.
I was talking about the horizontal line under i*sin(x), where you wrote 0
I was talking about the horizontal line under i*sin(x), where you wrote 0
#10 Опубликовано: 18.06.2014 15:01:52
Ahhh... the horizontal line is a simple fraction / 
You can add the domain limiter:
- to the numerator, if you want to see a null value outside the domain;
- to the denominator, otherwise.
Booleans result is 0 for false and 1 for true, so [math eng]something/0[/math] is not visible.
The ternary boolean operator under the line is part of the Functions' Extension plugin, following the link in the attachments of the first post you can see the syntax (in the example above I've used ltlt and tab)

You can add the domain limiter:
- to the numerator, if you want to see a null value outside the domain;
- to the denominator, otherwise.
Booleans result is 0 for false and 1 for true, so [math eng]something/0[/math] is not visible.
The ternary boolean operator under the line is part of the Functions' Extension plugin, following the link in the attachments of the first post you can see the syntax (in the example above I've used ltlt and tab)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#11 Опубликовано: 18.06.2014 15:24:03
ok thanks again.
I am missing something.
If I type at the denominator
0 it has no effect. Graph is plotted over the entire region.
if I copy from your original file 0 Is there anything special the way I am supposed to write it??
Multiple plots - wrong2.sm (6 КиБ) скачан 38 раз(а).
I am missing something.
If I type at the denominator
0
if I copy from your original file 0
Multiple plots - wrong2.sm (6 КиБ) скачан 38 раз(а).
#12 Опубликовано: 18.06.2014 15:27:23
ltlt!!!
Thank you!
Thank you!
#13 Опубликовано: 18.06.2014 17:34:52
Yes 
because when you type < < you obtain [math eng]#<#<#[/math] that seems a ternary operator but is just a boolean less nested inside another boolean less; using parentheses indeed is [math eng]((#<#)<#)[/math], so in the end you have [math eng]((0
Without plugins booleans AND/OR are needed, as shown in my first post: [math eng](0

because when you type < < you obtain [math eng]#<#<#[/math] that seems a ternary operator but is just a boolean less nested inside another boolean less; using parentheses indeed is [math eng]((#<#)<#)[/math], so in the end you have [math eng]((0
Without plugins booleans AND/OR are needed, as shown in my first post: [math eng](0
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 страниц (14 вхождений)
-
Новые сообщения
-
Нет новых сообщений