MATLAB How can I store wavelet values in an array while using a loop in MATLAB?

  • Thread starter Thread starter Abdullah266
  • Start date Start date
  • Tags Tags
    Matlab Wavelet
AI Thread Summary
To generate a Ricker wavelet in MATLAB and convolve it with Earth reflectivity, the user needs to store the computed wavelet values in an array rather than overwriting the variable in a loop. The correct approach involves initializing an array and assigning each computed value of the wavelet to the corresponding index in that array. The suggested code modification involves using an index based on the loop variable to store each value, ensuring that all values are retained for convolution. For further assistance with arrays, users are encouraged to consult the MATLAB help documentation.
Abdullah266
Messages
1
Reaction score
0
Hi all,
I want to generate a ricker wavelet using MATLAB then I convolve it with the Earth reflictivity (e) to get a seismic trace

I have (e) and I would like to generate ricker using the equation
w=(1-(2*pi^2*f^2*t^2))*exp(-pi^2*f^2*t^2)
between t:dt:tf

I use loop in MATLAB to get the wavelet

for t=0:0.001:0.05
w=(1-(2*pi^2*f^2*t^2))*exp(-pi^2*f^2*t^2);
end

the problem is that MATLAB assign each w= a value
and when I convolve it with the e it convolve only the last value in w
so I want to get w in the form w=[ value1 value2 value ..]
insted of getting it
w= value1
w= value2
w=value 3
.
.
.

please I need your urgent help
 
Physics news on Phys.org
You have to store the values in a array, otherwise only the last value at t=0.05 will be stored in w.
Make w as an array like this
w(t/0.001+1)=(1-(2*pi^2*f^2*t^2))*exp(-pi^2*f^2*t^2);

Now w will have all values as desired.
For any help regarding arrays please refer to Matlab help documentation.
 

Similar threads

Replies
1
Views
2K
Replies
4
Views
2K
Replies
9
Views
5K
Replies
5
Views
3K
Replies
1
Views
4K
Replies
2
Views
4K
Back
Top