Вы находитесь на странице: 1из 8

Ioannis Sophocleous 0839142 Sensors and Signals: Matlab Coursework

3. Simulation exercises 3.1 Finding a step response The task was carried out by creating the simulation shown in figure 1. The settling time, rise time and sensitivity were used along with the equations given, to calculate the value of damping ratio and frequency. The transfer function was then found by equating the coefficients of the second order system.
Figure 1

Rise time(s) 0.5 0.5

Settling time(s) 20 1

Sensitivity(k) 2 2

Damping ratio ( ) 0.0735 1.4706

Transfer function
      Table 1

Figure 2

Figure 3

The graphs obtained for a settling time of 20 and 1 second is shown. It can be seen from figure 2 that the results obey the theory. The signal rises in 0.5 s and settles to 95%-105% in 20 s. A steady state value is given after the transients have died out at around 40 s. This is for a damping ratio of 0.0735 which is very small. Compar ing this with figure 3 it can be seen that for systems with a high damping ratio or even greater than 1 the theory is not valid. Therefore a limitation of this is that modelling systems that are highly damped is difficult and inaccurate. The system in figure 3 has a damping ratio of 1.47 and the settling time is not 0.5 s. It is instead much longer. In addition a highly damped system will reach a steady state value in the shortest time. This is why figure 3 reaches a steady state value in 10 s while figure 2 which is less damped takes approximately 40 seconds. An under damped system will also give an overshoot resulting from the step. The percentage overshoot obtained is dependent entirely on the damping ratio of the second order system. At damping ratio greater than 0.7 -0.8 the overshoot is very small and is likely that it cannot be observed in the data. The under damped system was calculated to have an overshoot of 79%. 3.2 Investigating the accuracy This experiment was carried out by changing the ordinary differential solver in the simulation configuration parameters. Two different simulations were plotted, each having a different solver and the results were observed on the same graph. The following results were obtained for the under damped and over damped system. For the under damped system ode45 and ode23 were compared. The red line shown below is ode45 and the blue is ode23. It is seen that ode45 converges faster to a steady value output and that the error associated with it, is much less than ode23. This is probably because ode23 uses a different integration and interpolation method which has higher order accuracy. In figure 5 the results are the same. It is shown that ode45 has a more accurate settling time by a very small amount compared to ode23.

Ioannis Sophocleous 0839142 Sensors and Signals: Matlab Coursework

Figure 4

Figure 5

3.3 Ramp Response The following system was used to model the error in the output and to determine the steady state response. The steady state error was measured for settling times of 20 and 1 seconds. Therefore this was carried out for a critically damped system ( >1) and for an under damped system ( <<1).
% Define settling time, rise time, and sensitivity Ts = 20; Tr = 0.5; K = 1; %Natural Frequency and Damping Wn = 1.02/Tr; Damp = 3/(Ts*Wn); %Define tranfer function coefficients c = 1/(Wn^2); b = (2*Damp)/Wn; a = 1; d = K; e = 0; %Obtain information from the simulation sim ('rampresponseresponse.mdl',20) %Plot values plot(tout,simout.signals.values,'r') grid on

Figure 6

Under damped system For the system with a settling time of 20 seconds the main results that were obtained was that the steady state error was 0.144 as shown in the figure below.

Figure 7 2

Ioannis Sophocleous 0839142 Sensors and Signals: Matlab Coursework

Figure 8

Figure 9

The figures shown above display the ramp response with a red line and the ramp input with a blue line. The under damped figure shows the ramp response fluctuating at the beginning but settles to a steady value at 30 seconds. It tracks the ramp input quite quickly and the error is very small. Looking at the over damped system it can be seen that the error is much bigger than the under damped system and there is also a time lag between the response and the input which is equal to the error. This error is systematic. The nonlinearity in the under damped system is while in the over damped system its 1. Based to theory calculations the results found in both systems seem to agree with the theoretical values. The calculation carried out is shown below:
   







It is shown that also the theoretical values agree with the experimental values. The value of corresponds to the error of the output which is shown here to be 0.144 as it is shown on figure 4.

3.4 Frequency response of a system The transfer function of a first order dynamic system was obtained by taking Laplace transform of both sides and by using the table with the Laplace transforms. For we obtain

Expanding and rearranging we obtain:


 

Ioannis Sophocleous 0839142 Sensors and Signals: Matlab Coursework


 
for f=0.1:1:1000 sim('magneticcompass',5); array(r,c)=f; %finding steady state gain Output=(mean((simout.signals.values).^2))^0.5; array(2,c)=Output; Input=(mean((simout1.signals.values).^2))^0.5; array(3,c)=Input; steadystategain=Output/Input; array(4,c)=Output; db = 20*LOG10(steadystategain); array(5,c)=db; c=c+1; end % plotting in logarithmic scale semilogx(array(1,:),array(5,:))

Figure 10

The next step was to create the simulation with a sine wave as the input. The output magnitude and input magnitude were then used to calculate the gain of the system.
 

The following graph was obtained:

Figure 11

Figure 12

The graph shows the ideal frequency response in green and the actual frequency response in blue. Notice that the bandwidth is where the response drops to 1/ of its pass band. Hence as it is shown with the black line its magnitude is -3dB. The graph on the right was the initial frequency response that was obtained. This is because matlab uses different integration methods to obtain the graphs. The graph on the left is obtained with a smaller step size than the graph on the right and hence the uniform line.

Ioannis Sophocleous 0839142 Sensors and Signals: Matlab Coursework The theoretical value for the bandwidth of the system can be found from
which is 100rad/s as

shown in the graph above. To check that the frequency response found is correct the graph is compared with the theoretical graph found by:





 dB 0 0 -3 -20
Table 2

The table on the right shows that by using theory to calculate the frequency response we get exactly the same shape as above with a bandwidth frequency at 10 rad /s.

0 1 10 1000

1 1 0.707 0.10

4 Modelling a sensor system Magnetic Compass Frequency response:


  0   

G(j ) = 1 dB = 0 G(j ) = as increases by a decade G(j ) decreases by 100 slope = -40dB To find the bandwidth we set  = 3.15 as shown in the graph.

The graphs above show the ramp and step response of the magnetic compass. The response after the low pass filter is shown in red and it is compared with the response after the transfer function. It can be seen that for the step input the filter cuts all the high frequencies and also reduces overshoot that was initially

Ioannis Sophoc eous 0839142 Sensors and Signals Matlab Course ork 80 but the response is still quite slow. For a ramp input the response is faster but there is a small error present which is unavoidable. Since the bandwidth is quite low and only at 3.15rad/s the response of the system is quite low. Settling and rise time are also higher.

Gyro o p ss:

i ure 12 Fi ure 13

It is noticed that there is more low frequency drift than high frequency noise. The gyroscope has a very fast response but it does not settle to a steady state value. It tends to drift away from the value and the random error, keeps increasing quite significantly. The signal is being processed through a high pass filter and therefore all high frequencies are allowed to pass giving the graph on the left.

Filters:

Ioannis Sophocleous 0839142 Sensors and Signals Matlab Coursework The two graphs above show how low and high pass filters work. A high pass filter allows only high frequencies to pass through, in this case frequencies above 0.5rad/s. The low pass filter allows frequencies less than 1rad/s to pass through. These are complementary filters so that when they are added together they give 1 for all values of s.


Sensor System:

The graph shows how the complete sensor system is modelled. To produce a good info of the heading the two filters were placed at the magnetic compass and gyrocompass respectively. The low pass filter had a bandwidth of 1 dB which was very close to the bandwidth of the input signal which was 3dB. The lower the bandwidth means that we attenuate the desired signal. As for the high pass filter the gyroscope is much better at high frequencies and e hibits low errors. Therefore the high pass filter allows higher frequencies to pass through. The result of the two compasses including the filtering is shown below.


The graph shows that the resulting signal from the two compasses has a fast response to the input, has a small error and the error does not drift away although some noise is still observed. Also the error moves steadily on the heading line which is 1. The peak overshoot has dramatically decreased from 80 to 20 % and the settling time has decreased to approximately 15s.


Ioannis Sophocleous 0839142 Sensors and Signals Matlab Coursework




Con lusion


Magnetic Compass Response Error overshoot Noise Slow Low High Low

Gyrocompass Fast High Low High

Sensor system Fast Low Low Average

It is concluded that the sensor produces a fairly fast and accurate signal compared to the input signals. The trade off to get a good response and a low error was the amount of noise that remained in the signal. Complimentary filtering is a method that is quite extensively in the aerospace industry and the results obtained are of high-quality as shown above.

Вам также может понравиться