FOURIER TRANSFORM PROBLEM ERROR: Maximum variable size allowed by the program is exceeded.

6 ビュー (過去 30 日間)
Shane
Shane 2013 年 1 月 28 日
CODE:
-------------------------------------------------------------
lambda = 800e-9; % laser pulse wavelength used to define dt
T = lambda/ 3e8 ; %defining period of the pulse
n=10;
dt = T/n ; %dt is the step size
tau = 5e-15; %tau is laser pulse length
tmax = 10 * tau ; % plot size
E0 = 1 ;
w = (2 * pi * ( 3e8))/ lambda;
t= -tmax : dt : tmax ;
E = E0 * (exp( - ( (t/tau).^2) )) .* (cos(w * t));
dw=(2*pi)/T;
X=abs(fft(E));
X=fftshift(X);
N=(2*tmax)/dt;
F=[-((N/2)*dw):(dw*(N/2)-1)]/N;
plot(F,X)
xlabel('frequency/f_s');
ylabel('time/s');
title('Fourier Transform of a Laser Pulse');
------------------------------------------------------------
When this m.file is ran this appears on screen:
>> energy
Maximum variable size allowed by the program is exceeded.
Error in energy (line 15) F=[-((N/2)*dw):(dw*(N/2)-1)]/N;
The aim is producing a Fourier transform on a laser pulse using the built in fft function, I've read answers and understand that it is probably the dw variable that is causing the problem, the problem is that all the values are stated in the question. The only variables I can change are tau(from a given set), I can change n as I please although dt must remain small enough to ensure all frequencies ca be resolved
Any help will be appreciated Shane

回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by