what is the sampling frequency in wavelet method?

Hello. I have a 1-D signal with 300 samples during 30 secs. I've extracted the frequencies which are involve in the signal already in order to compare with wavelet method.I used following codes to determine the frequencies of the signal.I guess my problem is with determining the "Fs" value. I've selected 300,100,10,... but the output was nonsense, cause the frequencies suppose to be in range of 0.1Hz,0.05Hz. but with selected "Fs" values the frequencies are about 30,10,0.7 which are not the expected frequencies.Also I would like to ask How can I estimate the damping of each frequency modes. Thanks for a fast reply
%%------system data-------
Fs=100; % what should it be? my time interval is 0.1 but it doesn't work too
t=0:299;
x=data; % its my signal value
%%------------------------
wname = 'morl';
scales = 1:1:128;
coefs = cwt(x,scales,wname);
freq = scal2frq(scales,wname,1/Fs);
surf(t,freq,abs(coefs)); shading('interp');
xlabel('Time'); ylabel('Frequency');
figure;
wscalogram('image',coefs,'scales',freq,'ydata',x);
hold on
figure;
plot(freq,coefs)

2 Comments

Hello, I believe the sampling frequency is not of much importance in your problem. withUsing Scal2frq is not going to give you the actual frequencies involved in the signal. It just provides the pseudo-frequencies which may not match with the actual frequencies. The pseudo frequencies depends on the type of wavelet and its center frequencies. So, first thing is you have to find a way to figure out the actual frequencies involved in it also please let me know if u do that.
Hi Ajay. thanks for your comment, AS I saw in recent works,they've used Morlet wavelet in my case . also I don't know how to set the center frequency of wavelet, I thought matlab is doing it with Fourier method itself .Also I have the eigenvalues of the system too. so simply I have the frequencies that associated with the system too, but I want to run wavelet transform and see those frequencies by wavelet too. but I cant get the accurate frequencies. Is there any way to get the accurate frequencies that involve in the signal? Also I saw they estimated the damping of each frequency by calculating the decaying rate of each frequencies of the time[it has kinda formulation that i didn't get it]. do you know how to estimate the damping rate of the modes as well? Kind regards.

Sign in to comment.

 Accepted Answer

hi,
you have N=300 points for duration t=30 secs , then the samle rate is f=N/t=10Hz
or you can perform this way :
T=linspace(0,30,300);
Fs=ceil(inv(T(2)-T(1)));
The Nyquist condition is respected because you mentioned that the expected frequencies are 0<f<0.1 Hz .

5 Comments

Hi, Thanks for your answer Youssef. I changed that bit but still I can't see the expected frequencies. expected frequencies are 0.03,0.07,0.1 But the Output of this code shows frequency in range of[0,10]in the plot. as I see the freq are 0.5,0,0.9,1,2.7 due this code which are not close to what it must be. should I define my signal with different sampling rate? like more resolution. also did I use the scal2frq function correctly? "the changed code is as follow" Thanks in advance t=linspace(0,30,300); Fs=ceil(inv(t(2)-t(1))); x=data(:,2); wname = 'morl'; scales = 1:1:32; coefs = cwt(x,scales,wname); freq = scal2frq(scales,wname,1/Fs); surf(t,freq,abs(coefs)); shading('interp'); xlabel('Time'); ylabel('Frequency'); figure; wscalogram('image',coefs,'scales',freq,'ydata',x); hold on figure; plot(freq,coefs)
hi, The sample rate should be the same in the whole program, what you said is right, more resolution can discern the three frequencies . I never worked with the commands scal2frq, but see this example it can help :
t=linspace(0,30,300);
Fs=ceil(inv(t(2)-t(1)));
f=[0.03 0.07 0.1];
y=sin(2*pi*f(1)*t)+sin(2*pi*t*f(2))+sin(2*pi*t*f(3));
N=2024;
Fy=abs(fft(y,N));
Freqq=(0:N-1)*Fs/N;
figure, plot(Freqq(1:end/2),(Fy(1:end/2)));
the more you decrease N , the less ability to locate the three components .
Thanks dude. Still there is sth that confuse me about selecting the proper sampling rates.Here I run 3 tests to clarify what I mean. the code is at the bottom. test1: f=[1 3 6],N=300,Fs=10 the result is not very accurate but it is bearable cause the information was not enough. but with changing the N=3000,Fs=100 the result is fine and shows the desired frequencies. Test2: f=[0.1 0.3 0.6],N=300,Fs=10 the result is very accurate.but i am wonder when I change the N=3000,Fs=100 the result is inaccurate.while I remained more information for my signal by N=3000,Fs=100 the last test show what i mean clearly. test3: f=[0.01 0.03 0.06],N=300,Fs=10 the result is Inaccurate.with N=3000,Fs=100 the result is still inaccurate.also with N=30,Fs=1. the result is inaccurate too. cause the signal doesn't have enough information. so the question is "what sampling rate should I select to see frequencies in range of [0 0.1]{like 0.01,0.05}. also further I have frequencies like 0.03,0.5,1.3 in my actual work. so what sampling rate should I select. Kind regards Here is the code. change the 1st two lines with the tests info. %tests f=[1 3 6]%f=[0.1 0.3 0.6]%f=[0.01 0.03 0.06] %N=30,300,3000 t=linspace(0,30,300); Fs=ceil(inv(t(2)-t(1))); x=sin(2*pi*t*f(1))+sin(2*pi*t*f(2))+sin(2*pi*t*f(3)); wname = 'morl'; scales = 1:1:128; coefs = cwt(x,scales,wname); freq = scal2frq(scales,wname,1/Fs); figure; plot(freq,coefs) %test1 axis([0 10 -20 20]) %test2 axis([0 1 -20 20]) %test3 axis([0 0.1 -20 20])
i think you can use visualization technique, like logarithmic scale to expand the closer values :
semilogx(Freqq(1:end/2),(Fy(1:end/2)));
Excuse me I didn't understand where to put that code.semilogx(Freqq(1:end/2),(Fy(1:end/2))); also how can I write my codes neat like your with gray fonts with multilines.aslo would you run the codes I have wrote please. Best regards

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!