How to use 13 bandpass Ormsby filter for seismic signal with their integration of 13 bandpass and plot 13 acceleration and 13 integrations in a page?
9 次查看(过去 30 天)
显示 更早的评论
Urgent Help
Hello Dear Expert, I want to process a seismic signal where I want to perform 13 bandpass ormsby filter to see how signal behave in a certain bandpass filter and their integration behavior. Any one can help with details explanation will be remembred lifelong. I am sharing some of the information of the code here.
clear all
% Load your seismic data (time and acceleration)
t = xlsread('San_Fernando_records', 'sheet1', 'A2:A5952'); % time vector
N_s = xlsread('San_Fernando_records', 'sheet1', 'B2:B5952'); % North_south Acceleration
% Determine the sampling frequency (Fs)
Fs = 1 / (t(2) - t(1));
% Define the frequency bands for the 13 bandpass filters
f11 = [0.15, 0.05, 0.08, 0.15, 0.27, 0.45, 0.80, 1.30, 1.90, 2.80, 5.00, 8.75, 16.00]; % Lower cutoff frequencies for each band
f12 = [0.2, 0.07, 0.10, 0.17, 0.30, 0.50, 0.90, 1.50, 2.20, 3.50, 6.00, 10.25, 18.00]; % Lower rolloff frequencies for each band
f13 = [25.0, 0.08, 0.15, 0.27, 0.45, 0.80, 1.30, 1.90, 2.80, 5.00, 8.75, 16.00, 25.00]; % Upper rolloff frequencies for each band
f14 = [27.0, 0.10, 0.17, 0.30, 0.50, 0.90, 1.50, 2.20, 3.50, 6.00, 10.25, 18.00, 27.00]; % Upper cutoff frequencies for each band
I think ,i also need to use different filter order for every bandpass but not sure, please explain for me. And I am also including threshold level in integration plot which is required for me.
% Define filter orders, upper, and lower threshold levels for each band
filter_orders = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
threshold_lower_levels = [0.02, 0.03, 0.04, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.04];
threshold_upper_levels = [0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.97, 0.97];
0 个评论
回答(1 个)
Namnendra
2024-10-23,22:09
Hi,
To process a seismic signal using 13 bandpass Ormsby filters, you'll need to create a workflow that applies these filters to your data and analyzes the results. An Ormsby filter is a type of bandpass filter defined by four corner frequencies: two for the passband and two for the stopband. Here's a detailed explanation of how to implement this in MATLAB:
Steps to Implement the Ormsby Bandpass Filters
1. Load and Prepare Data:
- You've already loaded the time vector `t` and the seismic data `N_s`. Ensure that your data is correctly imported.
2. Define the Sampling Frequency:
- You have calculated the sampling frequency `Fs` as `1 / (t(2) - t(1));`. This is correct.
3. Define the Ormsby Filter Function:
- An Ormsby filter can be implemented by defining a filter function that uses the specified corner frequencies. The filter function will apply the bandpass characteristics to the seismic signal.
4. Apply the Filters:
- Loop over each frequency band and apply the Ormsby filter to the seismic data. Use the defined corner frequencies and filter orders.
5. Integrate the Filtered Signals:
- After filtering, integrate the signal to analyze its behavior over time. Integration can be done numerically using the `cumtrapz` function in MATLAB.
6. Apply Threshold Levels:
- Use the threshold levels to analyze the integrated signals and highlight regions of interest.
7. Visualize the Results:
- Plot the filtered and integrated signals to visualize the effects of each bandpass filter.
MATLAB Implementation
Here's a MATLAB script that outlines these steps:
clear all;
% Load your seismic data (time and acceleration)
t = xlsread('San_Fernando_records', 'sheet1', 'A2:A5952'); % time vector
N_s = xlsread('San_Fernando_records', 'sheet1', 'B2:B5952'); % North_south Acceleration
% Determine the sampling frequency (Fs)
Fs = 1 / (t(2) - t(1));
% Define the frequency bands for the 13 bandpass filters
f11 = [0.15, 0.05, 0.08, 0.15, 0.27, 0.45, 0.80, 1.30, 1.90, 2.80, 5.00, 8.75, 16.00];
f12 = [0.2, 0.07, 0.10, 0.17, 0.30, 0.50, 0.90, 1.50, 2.20, 3.50, 6.00, 10.25, 18.00];
f13 = [25.0, 0.08, 0.15, 0.27, 0.45, 0.80, 1.30, 1.90, 2.80, 5.00, 8.75, 16.00, 25.00];
f14 = [27.0, 0.10, 0.17, 0.30, 0.50, 0.90, 1.50, 2.20, 3.50, 6.00, 10.25, 18.00, 27.00];
% Define filter orders, upper, and lower threshold levels for each band
filter_orders = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
threshold_lower_levels = [0.02, 0.03, 0.04, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.04];
threshold_upper_levels = [0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.97, 0.97];
% Loop through each band
for i = 1:length(f11)
% Design the bandpass filter
bpFilt = designfilt('bandpassiir', 'FilterOrder', filter_orders(i), ...
'HalfPowerFrequency1', f12(i), 'HalfPowerFrequency2', f13(i), ...
'SampleRate', Fs);
% Apply the filter to the seismic data
filtered_signal = filtfilt(bpFilt, N_s);
% Integrate the filtered signal
integrated_signal = cumtrapz(t, filtered_signal);
% Apply threshold levels
lower_threshold = threshold_lower_levels(i) * max(abs(integrated_signal));
upper_threshold = threshold_upper_levels(i) * max(abs(integrated_signal));
thresholded_signal = integrated_signal;
thresholded_signal(integrated_signal < lower_threshold | integrated_signal > upper_threshold) = NaN;
% Plot the filtered and integrated signals
figure;
subplot(3, 1, 1);
plot(t, N_s);
title(['Original Signal - Band ', num2str(i)]);
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3, 1, 2);
plot(t, filtered_signal);
title(['Filtered Signal - Band ', num2str(i)]);
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3, 1, 3);
plot(t, integrated_signal, 'b');
hold on;
plot(t, thresholded_signal, 'r');
title(['Integrated Signal with Threshold - Band ', num2str(i)]);
xlabel('Time (s)');
ylabel('Integrated Amplitude');
legend('Integrated Signal', 'Thresholded Signal');
hold off;
Explanation of the Code
1. Filter Design:
- The `designfilt` function is used to create a bandpass filter using the specified corner frequencies and filter order. The `HalfPowerFrequency1` and `HalfPowerFrequency2` parameters set the roll-off frequencies, while `FilterOrder` determines the sharpness of the filter.
2. Filtering:
- The `filtfilt` function is applied to the seismic data `N_s` to filter it with zero-phase distortion, which is crucial for preserving the waveform characteristics.
3. Integration:
- The `cumtrapz` function numerically integrates the filtered signal over time, which is useful for observing cumulative effects.
4. Threshold Application:
- The integrated signal is thresholded to highlight significant changes. Values outside the defined thresholds are set to `NaN` for clarity in visualization.
5. Visualization:
- The script plots the original, filtered, and integrated signals. The use of subplots allows for easy comparison across the different processing stages.
Additional Considerations
- Filter Order: The choice of filter order affects the sharpness of the transition bands. Higher orders result in steeper transitions but may introduce ringing artifacts if too high.
- Threshold Levels: Adjust these levels based on the specific characteristics of your seismic data and the analysis objectives.
- Performance: If processing time is an issue, consider optimizing the filter design or using parallel processing for large datasets.
This script should provide a comprehensive approach to analyzing your seismic data using Ormsby bandpass filters. Adjust the parameters as needed to suit your specific data and analysis requirements.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!