From: sharmin shamsalsadati on 9 Jul 2010 11:08 Hi I want to plot a wavelet (Ricker wavelet) in the time domain using this formula: s(t)=(1-2*pi^2*f^2*(t-tc))*exp(-pi^2*f^2*(t-tc)^2); (t=-1:0.01:1;) and also add a 45 degree phase shift in to that. I multipled s(t) by exp(i*pi/4) to do so, but it finds error using that .It doesn't consider the phase shift(it says that the imaginary part is ignored). I am not sure how to the phase shift in to the wavelet in time-domain using Matlab. I will appreciate your helps and suggestions.
From: someone on 9 Jul 2010 12:48 "sharmin shamsalsadati" <sharmin_shamsalsadati(a)yahoo.com> wrote in message <i17e0k$o3e$1(a)fred.mathworks.com>... > Hi > > I want to plot a wavelet (Ricker wavelet) in the time domain using this formula: > s(t)=(1-2*pi^2*f^2*(t-tc))*exp(-pi^2*f^2*(t-tc)^2); > (t=-1:0.01:1;) > and also add a 45 degree phase shift in to that. I multipled s(t) by exp(i*pi/4) to do so, but it finds error using that .It doesn't consider the phase shift(it says that the imaginary part is ignored). I am not sure how to the phase shift in to the wavelet in time-domain using Matlab. > > I will appreciate your helps and suggestions. % What does your code look like and what exact error message do you get? % This works for me: t=-1:0.01:1; f = 1000; % dummy data tc = 0.1; % dummy data s = (1-2*pi^2*f^2*(t-tc)).*exp(-pi^2*f^2*(t-tc).^2); s1 = s.*exp(i*pi/4); % 45 deg phase shifted? % Note the use of the dot operator (element-by-element).
From: sharmin shamsalsadati on 9 Jul 2010 14:53 "someone" <someone(a)somewhere.net> wrote in message <i17js3$nr5$1(a)fred.mathworks.com>... > "sharmin shamsalsadati" <sharmin_shamsalsadati(a)yahoo.com> wrote in message <i17e0k$o3e$1(a)fred.mathworks.com>... > > Hi > > > > I want to plot a wavelet (Ricker wavelet) in the time domain using this formula: > > s(t)=(1-2*pi^2*f^2*(t-tc))*exp(-pi^2*f^2*(t-tc)^2); > > (t=-1:0.01:1;) > > and also add a 45 degree phase shift in to that. I multipled s(t) by exp(i*pi/4) to do so, but it finds error using that .It doesn't consider the phase shift(it says that the imaginary part is ignored). I am not sure how to the phase shift in to the wavelet in time-domain using Matlab. > > > > I will appreciate your helps and suggestions. > > % What does your code look like and what exact error message do you get? > > % This works for me: > > t=-1:0.01:1; > f = 1000; % dummy data > tc = 0.1; % dummy data > > s = (1-2*pi^2*f^2*(t-tc)).*exp(-pi^2*f^2*(t-tc).^2); > s1 = s.*exp(i*pi/4); % 45 deg phase shifted? > > % Note the use of the dot operator (element-by-element). This is my code: f=50; t=-1:0.01:1; s=(((1-2*pi^2*f^2*(t-tc).^2).*exp(-pi^2*f^2*(t-tc).^2))); s1=s.*exp(i*pi/4); plot(s1,t) It shows a warning message: "Imaginary parts of complex X and/or Y arguments ignored" and the plot it gives me doesn't have the phase shift applied in to that. Thank you
From: someone on 9 Jul 2010 15:10 "sharmin shamsalsadati" <sharmin_shamsalsadati(a)yahoo.com> wrote in message <i17r6f$h6h$1(a)fred.mathworks.com>... > "someone" <someone(a)somewhere.net> wrote in message <i17js3$nr5$1(a)fred.mathworks.com>... > > "sharmin shamsalsadati" <sharmin_shamsalsadati(a)yahoo.com> wrote in message <i17e0k$o3e$1(a)fred.mathworks.com>... > > > Hi > > > > > > I want to plot a wavelet (Ricker wavelet) in the time domain using this formula: > > > s(t)=(1-2*pi^2*f^2*(t-tc))*exp(-pi^2*f^2*(t-tc)^2); > > > (t=-1:0.01:1;) > > > and also add a 45 degree phase shift in to that. I multipled s(t) by exp(i*pi/4) to do so, but it finds error using that .It doesn't consider the phase shift(it says that the imaginary part is ignored). I am not sure how to the phase shift in to the wavelet in time-domain using Matlab. > > > > > > I will appreciate your helps and suggestions. > > > > % What does your code look like and what exact error message do you get? > > > > % This works for me: > > > > t=-1:0.01:1; > > f = 1000; % dummy data > > tc = 0.1; % dummy data > > > > s = (1-2*pi^2*f^2*(t-tc)).*exp(-pi^2*f^2*(t-tc).^2); > > s1 = s.*exp(i*pi/4); % 45 deg phase shifted? > > > > % Note the use of the dot operator (element-by-element). > This is my code: > f=50; > t=-1:0.01:1; > s=(((1-2*pi^2*f^2*(t-tc).^2).*exp(-pi^2*f^2*(t-tc).^2))); > s1=s.*exp(i*pi/4); > plot(s1,t) > It shows a warning message: "Imaginary parts of complex X and/or Y arguments ignored" and the plot it gives me doesn't have the phase shift applied in to that. > > Thank you % So, your problem is with the plot command. doc plot % As the help says (first paragraph in description): plot(Y) plots the columns of Y versus their index if Y is a real number. If Y is complex, plot(Y) is equivalent to plot(real(Y),imag(Y)). In all other uses of plot, the imaginary component is ignored. % Think about what you are doing. % Hint: perhaps you need to use the abs function.
From: Walter Roberson on 9 Jul 2010 15:17 sharmin shamsalsadati wrote: > This is my code: > f=50; > t=-1:0.01:1; > s=(((1-2*pi^2*f^2*(t-tc).^2).*exp(-pi^2*f^2*(t-tc).^2))); > s1=s.*exp(i*pi/4); plot(s1,t) > It shows a warning message: "Imaginary parts of complex X and/or Y > arguments ignored" and the plot it gives me doesn't have the phase shift > applied in to that. plot(real(s1),t,'r',imag(s1),t,'g',abs(s1),t,'b');
|
Pages: 1 Prev: printing to PDF in black/white Next: How to set input - outup data in Parameter Estimation |