Clear Filters
Clear Filters

How can I apply vel_smoother to a 3D data?

2 views (last 30 days)
Ahmed
Ahmed on 22 Mar 2024
Commented: akshatsood on 23 Mar 2024
My ip = 176 139 48, if I apply following command
ip0 = vel_smoother(ip,128, .03, 1);
The error appears
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in vel_smoother (line 8)
c=[cleft, c, cright];
Error in S2_3D_seismic_modeling (line 36)
ip0 = vel_smoother(ip,128, .03, 1);
How can i get a smoothed model?

Answers (1)

akshatsood
akshatsood on 22 Mar 2024
Edited: akshatsood on 22 Mar 2024
Hello @Ahmed,
The error you are encountering, "Dimensions of arrays being concatenated are not consistent", suggests that when attempting to concatenate arrays in the "vel_smoother" function (specifically on line 8 with "c=[cleft, c, cright];"), the dimensions of "cleft", "c", and "cright" do not align properly for horizontal concatenation.
Without seeing the full code of "vel_smoother", I can provide you with a general approach to troubleshoot and fix this issue. The goal of the "vel_smoother" function seems to be to smooth your input velocity model "ip" by applying some form of filtering or averaging.
Steps to Troubleshoot and Fix
1. Check Dimensions: Ensure that "cleft", "c", and "cright" have the same number of rows if you are trying to concatenate them horizontally. Use "size" or "length" function to check their dimensions before the concatenation line.
disp(size(cleft));
disp(size(c));
disp(size(cright));
2. Adjust Dimensions: If the dimensions do not match, you will need to adjust them. This might involve slicing arrays or changing how they are generated so that they align correctly.
3. Understanding Concatenation: Remember that for horizontal concatenation (using "[a, b, c]"), the number of rows must be the same. For vertical concatenation (using "[a; b; c]"), the number of columns must be the same.
If you can provide more details about the "vel_smoother" function, especially how "cleft", "c", and "cright" are being generated and what their intended dimensions are relative to "c", I can offer more specific advice.
I hope this helps.
  4 Comments
Ahmed
Ahmed on 22 Mar 2024
@akshatsood Yes itis solved as I write in the previous comment, I just applied a loop for 3rd dimension. Do you think it is fine?
akshatsood
akshatsood on 23 Mar 2024
Hi @Ahmed, seems fine as now the dimensions tend to match. In case you require any additional assistance, please let me know.

Sign in to comment.

Categories

Find more on Matrix Computations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!