shifting a gaussian pulse
6 views (last 30 days)
Show older comments
I wish to shift(delay) a Gaussian pulse in time domain, plot the delayed signal and its Fourier transform over a particular length x(0:16). generally if we have a signal f(t) we shift the signal using f(t-k). For the following Gaussian pulse i tried the same but i get an error. Each contribution is appreciated
clc clear all
Po= 4; % [mW] initial peak power
C = 0; % Chirping Parameter
m = 1; % Super Gaussian parameter
t0 = 100e-12; %initial pulse width
vgroup= 2e8;
alpham=0.24;
attn=0.24;
taum = 10000;
dtau = 2*taum/2^12; %1.953
tunit= 1e-12; % make time unit in psec
tau = (-1000:dtau:(taum-dtau))*tunit;
x=0:16;
bt = sqrt(Po)*exp(-0.5*(1+1i*C)*((tau./t0-(2.*x./vgroup)).^2)).*exp(0.24.*x)% my shifted format
subplot(2,1,1)
plot(tau,bt,'-rx');
l=trapz(x,bt);
subplot(2,1,2);
plot(x,l,'-rx');
I get the following error
??? Error using ==> rdivide Matrix dimensions must agree.
Error in ==> shift at 28 bt = sqrt(Po)*exp(-0.5*(1+1i*C)*((tau./t0-(2.*x./vgroup)).^2)).*exp(0.24.*x)% my shifted format
0 Comments
Answers (1)
David Young
on 29 Jun 2011
tau has 2252 elements but x has 17 elements, so you can't build expressions that try to combine them with elementwise operations. If you give x a scalar value, the computation succeeds (though the call to trapz fails).
Can you explain what you're aiming to do with x?
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!