• No se han encontrado resultados

El papel del maestro y del alumno ante la sociedad del conocimiento

In document UNIVERSIDAD DE SALAMANCA (página 80-84)

CAPITULO III FORMACIÓN DEL PROFESORADO PARA LA INTEGRACIÓN CURRICULAR DE LAS TIC

3.1 El papel del maestro y del alumno ante la sociedad del conocimiento

We set the simulation parameters by calling the menu command Simu-lation - Configuration Parameters. This action opens up the admirable Configuration Parameters window shown in Fig. 2.10.

Normally, the combined options for the solver are displayed on opening the entry Select: Solver. A solver is the procedure for numerical solu-tion of differential equasolu-tions, which is to be used for the present simulasolu-tion The reader might wonder what the model just developed has to do with a differential equation. Hopefully, this will be clearer after reading Section 2.3.

But first, refer to Problem 86.

The procedures can be chosen in the pull-down menus Solver Options Type: and Solver Options Solver:. They are divided into two classes, with and without variable step size adjustment (see the dis-cussion on variable step size below). The class is fixed in the pull-down menu Typeby choosing the parameter Fixed step or Variable step.

At this point discussing the procedures in detail would take us too far afield, and that is also unnecessary for understanding the following section. A

FIGURE 2.10 The Configuration Parameters (simulation parameter) window.

more profound discussion of the procedures would go well beyond the scope of this MATLAB-Simulink introduction, for the most modern mathematical procedures are brought into use. At the beginning we only need a few meth-ods ode23, ode45, and ode3 which are based on the familiar Runge-Kutta method, which we are already somewhat acquainted from Chapter 1. You can consider the other procedures after you have enough experience with simulations and come upon problems that require their use.

The class of Variable-step procedures work with a built-in step size control; that is, they change the step size of the numerical solution procedure in accordance with the dynamic behavior of the solution. If the solution varies little, then the step size is automatically set larger, while if the solution varies a lot, it is iterated with smaller step sizes. How much these step sizes are able to vary and with what tolerance can be controlled using the parameters Step sizeand tolerance. To go into more detail here would take us too far. The default values are sufficient for most cases.

If you select the Fixed-step procedure class, you’ll see that the menu for the step width changes. Now the desired (and thence, fixed) step size can be specified for the procedure. The other settings should initially be left unchanged.

The parameters Start time and Stop time are self-explanatory.

Of the further options that can be chosen under Select:, only the entry Data Import/Export is of interest in the beginning.

Under the heading Save Options the solution can also be interpo-lated between the chosen points in the variable step size procedure, if needed, in order to produce a smoother graphical solution. By select-ing Produce specified output only in the Output Options it can be specified exactly at which points the solution is to be calcu-lated. These points will be specified concretely in a suitable time vector (e.g., (0:0.1:10)) under the parameter Output Times that appears then. Internally, of course, the procedure calculates with variable control as usual and the solution is then determined by interpolation before out-put in the desired places. This way of processing the solution is particularly useful during operation with variable step sizes (perhaps for an optimal simulation time) when different solutions have to be compared with one another. In this case the solutions generally have different reference points, which can make comparison very difficult in certain cases. By choosing Produce specified output only, however, it is possible to force all the simulations to provide values at the same reference points.

But in the present example we initially make it easy and force Simulink from the start to employ a fixed step size by selecting the fixed-step procedure ode3and setting the step size parameter to 0.01.

The step size setting has a direct effect on the duration of the simulation, which can become unacceptably long with step size values that are too small.

Here, if necessary, a compromise between the duration and precision of the simulation can be found by testing with multiple experiments. Alternatively, a variable step procedure can (and should) be used.

After the simulation parameters have been set, the simulation can be started with the menu call Simulation - start. Alternatively, the tri-angle symbol in the icon toolbar can be clicked. Then the sinusoidal signal and associated integral shown in Fig. 2.11 will be plotted in the Scope block.

Since we have stored the result of the scope output as a MATLAB vari-able, S_test1_signals, we can also display the graph in MATLAB. A look at the workspace with

>> whos

Name Size Bytes Class

S_test1_signals 1001x3 24024 double array

t 1001x1 8008 double array

Grand total is 4004 elements using 32032 bytes

FIGURE 2.11 The result of the sample simulation.

shows that three vectors are saved as columns. One of the columns, the first, is the time vector (vector of the reference points for the solu-tions). In the present case the time vector is also supplied to the MATLAB workspace as the variable t, since the option Time was selected in the Configuration Parameters window under Data Import/Export - Save to Workspace.

>> plot(S_test1_signals(:,1), ...

[S_test1_signals(:,2),S_test1_signals(:,3)])

>> title('Result of s_test1 with ode3')

>> xlabel('Time /s')

>> ylabel('Function value')

>> grid

The result can also be produced with labels in MATLAB (Fig. 2.12).

FIGURE 2.12 The result of the sample simulation after processing by MATLAB.

PROBLEMS

Work through the following problems to practice using Simulink.

NOTE Solutions to all problems can be found in Chapter 4.

Problem 85

Try out the test system s_test1 with different simulation step sizes and using step size control.

Compare, in particular, the calculation time for a step size of 0.00001, once using ode3 directly with this step size and again using ode23 with conversion of the answer to a step size of 0.00001. Interpret the results.

Problem 86

Think about why the result of the simulation of the test system s_test1 displays the solution of the differential equation (initial value problem )

˙y(t) = x(t) , y(0) = 0 . (2.1) Which of the signals is x(t) and which is y(t)?

Problem 87

Design a Simulink test system s_soldiff for the differentiator block Derivative. For this it is best to modify the system s_test1.

Next, experiment with this as in Problem 85.

Problem 88

Think about how one could solve the initial value problem

˙u(t) = −2 · u(t) , u(0) = 1 (2.2) using Simulink and with the aid of the Integrator block and set up a Simulink system of this sort.

Compare the resulting numerical solution with the exact solution.

In document UNIVERSIDAD DE SALAMANCA (página 80-84)