Rename folders. Put data in correct folder
This commit is contained in:
		
							
								
								
									
										107
									
								
								disturbance-sr-rz/matlab/spindle_slip_ring_vibrations.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								disturbance-sr-rz/matlab/spindle_slip_ring_vibrations.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,107 @@
 | 
			
		||||
%% Clear Workspace and Close figures
 | 
			
		||||
clear; close all; clc;
 | 
			
		||||
 | 
			
		||||
%% Intialize Laplace variable
 | 
			
		||||
s = zpk('s');
 | 
			
		||||
 | 
			
		||||
% Load data
 | 
			
		||||
 | 
			
		||||
of = load('mat/data_024.mat', 'data'); of = of.data;
 | 
			
		||||
sr = load('mat/data_025.mat', 'data'); sr = sr.data;
 | 
			
		||||
sp = load('mat/data_026.mat', 'data'); sp = sp.data;
 | 
			
		||||
 | 
			
		||||
% Time domain plots
 | 
			
		||||
 | 
			
		||||
figure;
 | 
			
		||||
hold on;
 | 
			
		||||
plot(sp(:, 3), sp(:, 1), 'DisplayName', 'Spindle - 6rpm');
 | 
			
		||||
plot(sr(:, 3), sr(:, 1), 'DisplayName', 'Slip-Ring - 6rpm');
 | 
			
		||||
plot(of(:, 3), of(:, 1), 'DisplayName', 'OFF');
 | 
			
		||||
hold off;
 | 
			
		||||
xlabel('Time [s]'); ylabel('Voltage [V]');
 | 
			
		||||
xlim([0, 100]); ylim([-10 10]);
 | 
			
		||||
legend('Location', 'northeast');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% #+NAME: fig:slip_ring_spindle_marble_time
 | 
			
		||||
% #+CAPTION: Measurement of the geophone located on the marble - Time domain
 | 
			
		||||
% #+RESULTS: fig:slip_ring_spindle_marble_time
 | 
			
		||||
% [[file:figs/slip_ring_spindle_marble_time.png]]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
figure;
 | 
			
		||||
hold on;
 | 
			
		||||
plot(sp(:, 3), sp(:, 2), 'DisplayName', 'Spindle and Slip-Ring');
 | 
			
		||||
plot(sr(:, 3), sr(:, 2), 'DisplayName', 'Only Slip-Ring');
 | 
			
		||||
plot(of(:, 3), of(:, 2), 'DisplayName', 'OFF');
 | 
			
		||||
hold off;
 | 
			
		||||
xlabel('Time [s]'); ylabel('Voltage [V]');
 | 
			
		||||
xlim([0, 100]); ylim([-10 10]);
 | 
			
		||||
legend('Location', 'northeast');
 | 
			
		||||
 | 
			
		||||
% Frequency Domain
 | 
			
		||||
% We first compute some parameters that will be used for the PSD computation.
 | 
			
		||||
 | 
			
		||||
dt = of(2, 3)-of(1, 3);
 | 
			
		||||
 | 
			
		||||
Fs = 1/dt; % [Hz]
 | 
			
		||||
 | 
			
		||||
win = hanning(ceil(10*Fs));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% Then we compute the Power Spectral Density using =pwelch= function.
 | 
			
		||||
 | 
			
		||||
% First for the geophone located on the marble
 | 
			
		||||
 | 
			
		||||
[pxof_m, f] = pwelch(of(:, 1), win, [], [], Fs);
 | 
			
		||||
[pxsr_m, ~] = pwelch(sr(:, 1), win, [], [], Fs);
 | 
			
		||||
[pxsp_m, ~] = pwelch(sp(:, 1), win, [], [], Fs);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% And for the geophone located at the sample position.
 | 
			
		||||
 | 
			
		||||
[pxof_s, f] = pwelch(of(:, 2), win, [], [], Fs);
 | 
			
		||||
[pxsr_s, ~] = pwelch(sr(:, 2), win, [], [], Fs);
 | 
			
		||||
[pxsp_s, ~] = pwelch(sp(:, 2), win, [], [], Fs);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% And we plot the ASD of the measured signals:
 | 
			
		||||
% - figure [[fig:sr_sp_psd_marble_compare]] for the geophone located on the marble
 | 
			
		||||
% - figure [[fig:sr_sp_psd_sample_compare]] for the geophone at the sample position
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
figure;
 | 
			
		||||
hold on;
 | 
			
		||||
plot(f, sqrt(pxsp_m), 'DisplayName', 'Spindle - 6rpm');
 | 
			
		||||
plot(f, sqrt(pxsr_m), 'DisplayName', 'Slip-Ring - 6rpm');
 | 
			
		||||
plot(f, sqrt(pxof_m), 'DisplayName', 'OFF');
 | 
			
		||||
hold off;
 | 
			
		||||
set(gca, 'xscale', 'log');
 | 
			
		||||
set(gca, 'yscale', 'log');
 | 
			
		||||
xlabel('Frequency [Hz]'); ylabel('ASD of the measured Voltage $\left[\frac{V}{\sqrt{Hz}}\right]$')
 | 
			
		||||
legend('Location', 'southwest');
 | 
			
		||||
xlim([0.1, 500]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% #+NAME: fig:sr_sp_psd_marble_compare
 | 
			
		||||
% #+CAPTION: Comparison of the ASD of the measured voltage from the Geophone on the marble
 | 
			
		||||
% #+RESULTS: fig:sr_sp_psd_marble_compare
 | 
			
		||||
% [[file:figs/sr_sp_psd_marble_compare.png]]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
figure;
 | 
			
		||||
hold on;
 | 
			
		||||
plot(f, sqrt(pxsp_s), 'DisplayName', 'Spindle - 6rpm');
 | 
			
		||||
plot(f, sqrt(pxsr_s), 'DisplayName', 'Slip-Ring - 6rpm');
 | 
			
		||||
plot(f, sqrt(pxof_s), 'DisplayName', 'OFF');
 | 
			
		||||
hold off;
 | 
			
		||||
set(gca, 'xscale', 'log');
 | 
			
		||||
set(gca, 'yscale', 'log');
 | 
			
		||||
xlabel('Frequency [Hz]'); ylabel('ASD of the measured Voltage $\left[\frac{V}{\sqrt{Hz}}\right]$')
 | 
			
		||||
legend('Location', 'southwest');
 | 
			
		||||
xlim([0.1, 500]);
 | 
			
		||||
		Reference in New Issue
	
	Block a user