I want to calculate the Moving RMS on first break pics for seismic data.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lucas Spriggs
am 20 Nov. 2023
Kommentiert: Mathieu NOE
am 21 Nov. 2023
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 Kommentare
Star Strider
am 20 Nov. 2023
Bearbeitet: Star Strider
am 20 Nov. 2023
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.)
Akzeptierte Antwort
Mathieu NOE
am 20 Nov. 2023
hello again
see below , now you have the RMS values displayed in the legend (or you wanted to make a separate plot ? )
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1544882/image.png)
% 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;
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!