Solve MATLAB FFT Help for Unity Rectangular Pulse

  • Thread starter Fronzbot
  • Start date
  • Tags
    Fft Matlab
In summary, the conversation discusses finding the Fourier Transform of a unity amplitude rectangular pulse with a width of 2T using MATLAB. The attempt at a solution involves generating the pulse and its FFT, but the results do not match the expected values. The code is looking for help in identifying the issue.
  • #1
Fronzbot
62
0

Homework Statement


Find the Fourier Transform of a unity amplitude rectangular pulse of width 2T, where T=[ims]. Use MATLAB to plot the magnitude response of this signal's FT.


Homework Equations





The Attempt at a Solution


I got something that LOOKS right, but the first zero-crossing SHOULD be +-pi/T which equals 3.14e3, in this case (since I'm taking the Fourier Transform of an aperiodic rectangular pulse). However, when plotted, MATLAB is telling me it's about 2000. On top of that, the amplitude should be 2*T which, in this case, is 0.002 but MATLAB says it's 3... I have no clue what is going wrong with the code. Any help would be GREATLY appreciated.

Code:
clear all
close all

% Part 1

%Following generates pulse of width T
T = 1e-3; %half-width of rectangular pulse
dt = 1e-3;
ts = [-T:dt:T];
pulse = rectpuls(ts);


%Generate fft of pulse
N = 1024; %Number of samples
y=fftshift(fft(pulse,N)); 
ws = 2*pi/T;
waxis = [-ws/2:ws/N:ws/2-(ws/N)];
plot(waxis,abs(y))
title(['FT of Rectangular Pulse of width ',num2str(2.*T./1e-3),'ms']);
xlabel('w [rad/s]');
ylabel('Amplitude');
axis auto
 
Physics news on Phys.org
  • #2
anyone?
 

Related to Solve MATLAB FFT Help for Unity Rectangular Pulse

1. What is the purpose of using the MATLAB FFT function for Unity Rectangular Pulse?

The purpose of using the MATLAB FFT function for Unity Rectangular Pulse is to transform a signal from the time domain to the frequency domain. This allows for easier analysis and manipulation of the signal.

2. How do I use the MATLAB FFT function for Unity Rectangular Pulse?

To use the MATLAB FFT function for Unity Rectangular Pulse, you need to first define the signal in the time domain. Then, you can use the fft() function to transform the signal to the frequency domain. Finally, you can plot the results using the plot() function.

3. What is the syntax for using the MATLAB FFT function for Unity Rectangular Pulse?

The syntax for using the MATLAB FFT function for Unity Rectangular Pulse is: fft(y), where y is the input signal in the time domain.

4. Can the MATLAB FFT function for Unity Rectangular Pulse be used for signals of any length?

Yes, the MATLAB FFT function for Unity Rectangular Pulse can be used for signals of any length. However, for best results, it is recommended to use signals that are a power of 2 in length.

5. Are there any other functions that can be used in conjunction with the MATLAB FFT function for Unity Rectangular Pulse?

Yes, there are several other functions that can be used in conjunction with the MATLAB FFT function for Unity Rectangular Pulse, such as ifft(), fftshift(), and fft2(). These functions allow for further processing and analysis of the transformed signal in the frequency domain.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
393
  • Engineering and Comp Sci Homework Help
Replies
2
Views
967
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
396
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
472
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
Back
Top