필터 지우기
필터 지우기

I want to calculate the Moving RMS on first break pics for seismic data.

조회 수: 2 (최근 30일)
Hello. So I need to calculate the moving RMS for first break pics. I have already made a code to display the first break picks which is:
% Define the file name
file_name = 'RL7000SL8000.prn';
% Import data from the .prn file
data = importdata(file_name);
% Extract the three columns: source x, receiver x, and First Break Picks
source_x = data(:, 1);
receiver_x = data(:, 2);
first_break_picks = data(:, 3);
% Replace negative or zero values in first break picks with NaN
first_break_picks(first_break_picks <= 0) = NaN;
% Get unique source x locations
unique_source_x = unique(source_x);
num_sources = numel(unique_source_x);
% Define a colormap with enough colors for the unique source x locations
color_map = lines(num_sources);
% Create a new figure for the plot
figure;
% Plot lines for each unique source x location with a unique color
for i = 1:num_sources
source_x_location = unique_source_x(i);
idx = source_x == source_x_location;
% Plot the data with a unique color and label
plot(receiver_x(idx), first_break_picks(idx), 'Color', color_map(i, :), 'DisplayName', ['Source X = ', num2str(source_x_location)]);
hold on;
end
% Add axis labels and title
xlabel('Receiver X');
ylabel('First Break Picks');
title('First Break Picks vs. Receiver X for Different Source X Locations');
% Reverse the Y-axis so that 0 is at the top
set(gca, 'YDir', 'reverse');
% Add a legend to distinguish the source x locations
legend('Location', 'Best');
grid on;
% Customize the colors and line styles as needed
% Display the plot
hold off;
I have read the instructions on Moving RMS, but I have no clue how to utilize it on my code.
  댓글 수: 3
Lucas Spriggs
Lucas Spriggs 2023년 11월 20일
Hi, sorry thanks for the heads up. I edited and attached my data. However I had to change it back to an excel file, as I could not upload a .prn file.
Star Strider
Star Strider 2023년 11월 20일
편집: Star Strider 2023년 11월 20일
If you want to upload a .prn (or any other extension), use the zip function to enclose it in a .zip file, and then upload that. So long as it meets the file size limits, that should work. (It always helps for us to know what the file actually is, for example .txt, .csv, or something else.)

댓글을 달려면 로그인하십시오.

채택된 답변

Mathieu NOE
Mathieu NOE 2023년 11월 20일
hello again
see below , now you have the RMS values displayed in the legend (or you wanted to make a separate plot ? )
% Define the file name
file_name = 'RL7000SL8000.xlsx';
% Import data from the .prn file
data = importdata(file_name);
% Extract the three columns: source x, receiver x, and First Break Picks
source_x = data(:, 1);
receiver_x = data(:, 2);
first_break_picks = data(:, 3);
% Replace negative or zero values in first break picks with NaN
first_break_picks(first_break_picks <= 0) = NaN;
% Get unique source x locations
unique_source_x = unique(source_x);
num_sources = numel(unique_source_x);
% Define a colormap with enough colors for the unique source x locations
color_map = lines(num_sources);
% Create a new figure for the plot
figure;
% Plot lines for each unique source x location with a unique color
for k = 1:num_sources
source_x_location = unique_source_x(k);
idx = source_x == source_x_location;
% Plot the data with a unique color and label
x = receiver_x(idx);
y = first_break_picks(idx);
y_rms = sqrt(mean(y.^2));
plot(x, y, 'Color', color_map(k, :), 'DisplayName', ['Source X = ', num2str(source_x_location), ' / RMS = ', num2str(y_rms)]);
hold on;
end
% Add axis labels and title
xlabel('Receiver X');
ylabel('First Break Picks');
title('First Break Picks vs. Receiver X for Different Source X Locations');
% Reverse the Y-axis so that 0 is at the top
set(gca, 'YDir', 'reverse');
% Add a legend to distinguish the source x locations
legend('Location', 'Best');
grid on;
% Customize the colors and line styles as needed
% Display the plot
hold off;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by