Professional Documents
Culture Documents
temperature of that region will be within the range defined and, thus, the
definition of the range will become critical. If the minimum and maximum
values of temperature are T1 and T2 and the number of levels are n, then
the temperature range of a zone is given by
T2 - T1
n
4.4.1 comet
The comet() function comes in handy in such cases. In Listing 4-14, we
animate the equation x 5 − x3 + x +5 using the comet function.
115
Chapter 4 Plotting
4.4.2 paramfplot2d()
Time evolution of a function at multiple points can be represented by the
paramfplot2d() function. Let’s consider the evolution of the function
y = sin(x) + sin(2x) + sin(4x) (mixing of a signal with double and four times
its own frequency). The resulting signal is the complex waves combining
these three primary waves (sin(x), sin(2x), and sin(4x)), as shown in
Figure 4-17 and Listing 4-15.
116
Chapter 4 Plotting
1 deff('y=f(x,t)','y=t∗sin(x)+sin(2∗x)+sin(4∗x)')
// Def ining equation
2 x = linspace(−4∗%pi,4∗%pi,10e3); // def ining spatial steps
3 t = 100;
4 time_speed = 0:0.05:1; // step size determines speed of
animation
5 paramfplot2d(f,x,time_speed);
6 xtitle('Using paramfplot2d function to animate an equation')
7 xlabel('x')
8 ylabel('y')
Please note that deff is used to define a function. Its usage can be
checked from help deff. Its detailed usage will be discussed in the
chapter concerning the definition of Scilab function.
117
Chapter 4 Plotting
118
Chapter 4 Plotting
119
Chapter 4 Plotting
119
Chapter 4 Plotting
Figure 4-20. Separate multiple plots within the same figure using a
subplot
121