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

In summary, the conversation discusses generating a ricker wavelet in MATLAB and convolving it with Earth reflectivity to obtain a seismic trace. The speaker shares their equation for generating the wavelet and mentions using a loop in MATLAB to get the wavelet. However, they encounter a problem with only the last value of w being stored and seek urgent help to store all values in an array. They suggest referring to MATLAB's help documentation for assistance with arrays.
  • #1
Abdullah266
1
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
  • #2
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.
 

1. How do I generate a wavelet in MATLAB?

To generate a wavelet in MATLAB, you can use the wavefun function. This function allows you to specify the type of wavelet and the number of points in the wavelet. Alternatively, you can also use the morlet function to generate a Morlet wavelet in MATLAB.

2. What are the different types of wavelets available in MATLAB?

MATLAB offers a variety of wavelet functions, including Daubechies, Coiflets, Symlets, and Morlet wavelets. Each type of wavelet has its own unique properties and is suitable for different applications.

3. How can I visualize a generated wavelet in MATLAB?

You can use the plot function in MATLAB to visualize a generated wavelet. This will plot the wavelet as a function of time, allowing you to see its shape and characteristics.

4. Can I customize the properties of a generated wavelet in MATLAB?

Yes, you can customize the properties of a generated wavelet in MATLAB. The wavefun and morlet functions allow you to specify parameters such as the number of points, frequency, and duration of the wavelet.

5. How can I use a generated wavelet for signal processing in MATLAB?

To use a generated wavelet for signal processing in MATLAB, you can use the cwt function. This function performs continuous wavelet transform on a given signal using the specified wavelet. You can also use the waveletAnalyzer app for a more interactive and user-friendly approach to signal processing with wavelets in MATLAB.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
999
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
745
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
Back
Top