# Analyzing Seat Vibration Data Using MATLAB Products

This case study analyzes the amount of vibration a passenger experiences for a vehicle traveling over a road disturbance (bump). We want to determine the amount of reduction in displacement and acceleration that can be achieved using two different controllers. We have test data across 12 vehicle speeds for three schemes:

• Baseline Suspension System (uncontrolled)
• Controller 1: Actively Controlled Seat + Suspension System
• Controller 2: Low Cost Version of Controller 1

The primary difference between the two controller configurations are the implementation of the linear motor used to dampen oscillations in the seat. The dynamic range of the linear motors are:

• Controller 1: +/-100 N
• Controller 2: +/- 10 N

## Load Seat Vibration Data and Remove Undesired Noise

The first step in our analysis is to load the data from Excel Spreadsheet files and filter out any noise not related to the seat vibration dynamics. We use the filter we defined using the Filter Design and Analysis Tool and the M-Function (getSeatData) to import, filter, and plot the data.

```config = {'seatvib-baseline-speed',...
'seatvib-control1-speed',...
'seatvib-control2-speed'};
nConfig = length(config);
showplot = [ 1 6 12]; % which plots to show
for i = 1:nConfig
[X{i}, A{i}, C{i}, T{i}] = getSeatData(config{i},showplot);
end
speed = [ 5 10 15 20 30 40 50 60 70 80 90 100]; % mph
mph2mps = 0.44704; % we use this later
speed = speed*mph2mps; % speed in m/s
nSpeed = length(speed); % total number of speed trials
cSat = [ 1 100 10]; % Controller Limits
```

## Estimate Controller Performance

To evaluate the different configurations, we'll look at the maximum displacement, acceleration, and controller force (as % Full Range) observed at each speed.

```configColor = {'ro-','go-','ko-'};
configLegend ={'Baseline','Controller 1','Controller 2'};
close all % figures
figure, nextFig = gcf;
for i = 1:nConfig
Xmax{i} = max(abs(X{i}));
figure(nextFig),set(nextFig,'Visible','off')
plot(speed,Xmax{i},configColor{i}), hold on
xlabel('Speed (m/s)'); ylabel('Max Displacement (m)');
legend(configLegend{1:i})

Amax{i} = max(abs(A{i}));
figure(nextFig+1),set(nextFig+1,'Visible','off')
plot(speed,Amax{i},configColor{i}), hold on
xlabel('Speed (m/s)'); ylabel('Max Acceleration (m/s^2)');
legend(configLegend{1:i})

Cmax{i} = max(abs(C{i}))./cSat(i)*100;
figure(nextFig+2),set(nextFig+2,'Visible','off')
plot(speed,Cmax{i},configColor{i}), hold on
xlabel('Speed (m/s)'); ylabel('Max Controller Force (%Full Range)');
legend(configLegend{1:i})
if i == nConfig
hold off
set(nextFig,'Visible','on')
set(nextFig+1,'Visible','on')
end
end
```

Looking at displacement and acceleration, we see that Controller 1 and 2 are different primarily at low speeds and are similar at high speeds. We need to determine if this difference is significant and not a result of measurement error or noise.

## Model Controller Acceleration

We want to determine if the difference in the two controllers are significant in terms of the acceleration observed. The acceleration curves for both controllers appear to be similar and are significantly different at the low speed range. Let's determine if a single model captures both trends with only a change in one parameter. The model we will fit is:

where x1 is speed and x2 is a binary variable representing the different configurations (0 for Controller 1, 1 for Controller 2).

```y = [Amax{2} Amax{3}]';
x = [speed(:), zeros(nSpeed,1); speed(:), ones(nSpeed,1)];
f = @(a,x) a(1)*x(:,1).^(a(2)+a(3)*x(:,2))+a(4);
[b,R,J,Sigma,mse] = nlinfit(x,y,f, [.3 -1 0 .05]);
figure,plot(speed,Amax{2},'bo',speed,Amax{3},'ro')

xx = linspace(min(speed), max(speed))';
line(xx,f(b,[xx, zeros(size(xx))]), 'color','b')
line(xx,f(b,[xx, ones(size(xx))]), 'color','r')
xlabel('Speed (m/s)')
ylabel('Max Acceleration (m/s^2)')
legend('Controller 1','Controller 2')

bci = nlparci(b,R,'covar',Sigma);
colheads = {'Coef' 'Estimate' 'Lower' 'Upper'};
```
```    'Coef'    'Estimate'    'Lower'        'Upper'
'a'       [  2.8174]    [   2.1349]    [     3.5]
'b'       [ -3.5529]    [  -3.9698]    [  -3.136]
'c'       [  1.5559]    [   1.2894]    [  1.8223]
'd'       [0.017304]    [0.0091098]    [0.025497]

```

Note that the confidence interval for 'c' does not include 0, so the difference between Controllers is significant and not a result of noise or measurement error. At this point, Controller 1 has the best overall performance. However, if we are only concerned with the performance at moderate to high speed (>10 m/s) either configuration will be acceptable. Controller 2 has considerable cost advantage and we don't want to rule it out at this point.

Review of the controller force shows thatController 2 is saturated (max force) over the low speeds. This is a concern from a reliability point of view. With a saturated controller, we may run the risk of early failure and need to quantify if this will have an impact on our selection of controllers. For our intended application, we need to have >90% survive at least 1,000 hours.

```set(nextFig+2,'Visible','on')
```

## Load Survival Data and Visualize

To gain insight into the reliability of our two controller configurations, we tested 20 of each until failure. The test consisted of the entire seat and controller assembly and cycled under worst case conditions. The data was saved in an Excel Spreadsheet as the number of hours the assembly was tested before failure.

```clear all %data
close all %figures

format short g
avgLife = mean(lifeData)

plot(lifeData,'o-')
xlabel('Observation'); ylabel('Survival Time (hours)');
legend('Controller 1','Controller 2')
```
```avgLife =

1951.7       1716.7

```

The average values of the two configurations are similar in magnitude. In order to determine if the difference is real, and not a result of our sample size, we'll perform an Anslysis of Variance test to determine if the average values are statistically different.

## Analysis of Vairance (ANOVA)

ANOVA is an analysis technique that allows us to test for differences in means across groups of data. We'll use ANOVA to test if the difference in means is actually different given our small sample size.

```p = kruskalwallis(lifeData);
xlabel('Controller'); ylabel('Survival Time (hours)');
```

The p-value from the ANOVA table is around 0.25. This result indicates that the mean failure rates are not significantly different. While the mean failure rates cannot be declared different, we need to understand how the data differs in its distribution. The box plot shows us that Controller 2 has a wider dispersion of data. We'll fit a probability distribution to our data to characterize the data and determine if the two samples have different failure rates as a function of time.

## Perform Weibull Analysis on Survival Data

Survival data commonly follows a Weibull distribution. We'll check that our data follows a Weibull distribution and use the fitted distribution to estimate survival rates for our two configurations. The Statistics Toolbox has a graphical tool (dfittool) that provides a central access point for fitting distribution to data and performing related calculations from the fitted distributions. We'll use this tool to perform our Weibull Analysis on Controller 1, generate M-files to capture our analysis, and apply the analysis to Controller 2.

```dfittool(lifeData(:,1),[],[],'Experimental Data')
```

## Compare Survival Times for Each Controller

You have seen the analysis performed for Controller 1. We'll now use the M-file functions generated from our work in dfittool on configuration 2 and compare the results to configuration 1.

```% Survivor Function for Controller 1
figure, mySurvivor(lifeData(:,1));
xlabel('Survival Time (h)')
title('Controller 1')

% Survivor Function for Controller 2
figure, mySurvivor(lifeData(:,2));
xlabel('Survival Time (h)')
title('Controller 2')
```

The Survivor Function Plots show the fraction of the population that are likely to fail over time. Controller 1 has >95% survival rate at 1,000 hours. This meets our goal. Contorller 2, on the other hand, has a survival rate of around 80% at 1,000 hours. This does not meet our goal. Therefore, Controller 1 is the selected configuration for our application.

## Summary

We have seen that the two controller configurations testted significantly reduce the amount of displacement and acceleration a passenger is exposed to. Controller 1 meets our reliability criteria as well as had the best overall performance. Controller 2, while cheaper, does not meet our reliability requirement of >90% for >1,000 hours. Thus, controller 1 is the configuration selected for further development.