## Plot FunctionsYou can plot functions with thePlot command. The functions to be plotted can depend on one variable.
The general syntax for the plotting command is
You can enter for example the following command to plot a sine function: Plot(Sin(x)) Plot done x explicitly. If not specified, SpeQ will detect the function variable automatically.
Any name can be used for the variable. It's not necessary to use x as the variable name.## PropertiesYou can optionally add properties in thePlot function. An example is:
Plot(Sin(x), Color=Red, xMin=-3, xMax=3, GridStyle=Off, Title=My Figure) Plot done ## Multiple functions in one FigureThere are two ways to plot multiple functions in one figure. You can either enter multiple functions in one Plot command, or you can plot a function, keep the figure open, and plot another function. If the figure window is still open when you plot the second function, the first function will remain.Plot(Sin(x), 2*Cos(x)) Plot done Plot(Sin(x)) Plot done Plot(2*Cos(x)) Plot done ## Multiple FiguresYou can open multiple Figures at one time, up to 9 Figures. To plot a function in a second Figure instead of the first figure, you have to specify the number of the Figure.'plot a function. this function will be plotted in Figure 1 Plot(Sin(x)) Plot done 'plot a second function in Figure 2 Plot(Figure=2, 2*Cos(x)) Plot done 'plot a third function in Figure 5 Figure = 5 Figure = 5 Plot(x^2 / 10) Plot done ## FigureFunctions will be plotted in a figure. A figure looks like this:## Complex values and unitsNote that SpeQ can not plot functions that result in complex values or values with units. Therefore, for example the function Sqrt(x) is not plotted for values x < 0.## OverviewSpeQ has several functions available for plotting graphs.## Examples'Examples of plotting graphs 'Plot a few functions Plot(x^2 - 3) Plot done Plot(Sin(x)) Plot done 'Enter multiple functions in one plot command Plot(Sin(t), Cos(t)) Plot done 'Specify properties Plot(Figure=2, Sin(x)+Cos(2*x), Color = Pink) Plot done Plot(Figure=2, 0.5*x^3-2*x^2+x, Color = Purple) Plot done 'Specify properties beforehand Figure = 4; yMin = -3; yMax = 3; xMax=2; GridStyle = Off; Plot(Exp(0.5*x)); Plot(Exp(0.5*x) * Sin(2*x)); Plot(-Exp(0.5*x)); Figure = 5 Figure = 5 Plot(Exp(0.5*x) * Sin(2*x), LegendStyle = Off) Plot done 'Set tracepoint for a function xTrace = 1.5 xTrace = 1.570796327 'Read the traced functionvalue yTrace yTrace yTrace = 0 'An intersection with the x-axis is found, xTrace is 'snapped to that intersection. analyze the found xTrace xTrace / Pi Ans = 0.5 'Close figure 2 and 5 Close(2) Done Close(Figure=5) Done 'If you want to plot a constant, you have to give the variable explicitly 'because SpeQ is unable to detect a variable in the function. Plot(2.25) Error: Unable to detect a variable in function "2.25"... 'To solve the problem, define an arbitrary variable Plot(2.25, MyFavoriteVar) Plot done ## See AlsoEdit Properties, Graphs, Figure, Property window |