Hi Sohel, May I first suggest that you clean this code up a bit. It isn't easy to follow exactly what kind of signals you are creating. For example, instead of
lam1=1530; lam2=1565;
inc=(lam2-lam1)/(2^10-1);
Why not just ?
t = linspace(1530,1565,1024);
It appears from your code above you are using "lam" as your time vector. Then, you seemingly create a sine wave wtih expressions like
in the case of I_first where I have used t for your "lam". What exactly are you trying to do here? A little explanation about what signal you are trying to create would help us determine if perhaps you have an inadvertent error in the signal model. Note the equivalence of the following:
t = linspace(1530,1565,1024);
angle = 4*pi*1e5./t;
plot([angle' Q12'])
plot(cos(angle))
Were you trying to create a frequency-modulated signal with the above?
At any rate, I don't see how you can cleanly separate I_second from I_third. The frequencies of these two components are so close, whether intentional or not, that you have essentially just created one amplitude modulated signal. Note
plot([abs(fft(I_second))' abs(fft(I_third))'])
Now if I plot the sum of those two in time, you see the amplitude modulated signal
With respect to bandpass filtering, you are not going to be able to separate these components in a way that when you sum them back you get the original signal. You can however accomplish that with multiresolution techniques. In this case I would recommend a wavelet packet technique, modwptdetails. Please see Practical MRA for a introduction. So here:
mra = modwptdetails(I,5,'fk18');
plot(mra(1,:))
plot(mra(3,:))
Again, you cannot expect to separate I_second and I_third with any technique I know of. Now note that if I sum all the mra components back together
ts = sum(mra);
max(abs(ts-I))
I get back the original signal perfectly. Now if you compare the extracted MRA components, you see that except for the expected DC shifts (shifts in the mean), they quite accurately reproduce, I_first and I_second+I_third
subplot(2,1,1)
plot([mra(1,:)' I_first']), title('First');
axis tight
subplot(2,1,2)
plot([mra(3,:)' (I_second+I_third)']), title('Second+Third')
axis tight
To see that more clearly, let's add the DC shift in and compare the AM component extracted by the wavelet packet MRA with the original.
mu = mean(I_second+I_third);
figure
plot([mra(3,:)'+mu (I_second+I_third)']);
title('Comparison of wavelet packet with original')
axis tight
Hope that helps,
Wayne
0 Comments
Sign in to comment.