how can I do the fourier transform of triangular pulse using 'fft' function?

body of the function is- f(t)=[1-|t|/T], when|t|<T, else 0.

1 Comment

What is your problem? how to use fft function or how to generate a triangular pulse?. You have also, to specify the time interval

Sign in to comment.

 Accepted Answer

Sounds like homework, though you didn't say. Hint: Try using linspace() to create rising and falling ramps, then stitch together.
risingRamp = linspace(0, 1, int(T/2));
triangularPulse = [zeros(1, N), risingRamp, fallingRamp, zeros(1, N)];
see what you can do with that. Then call fft(). Try it yourself.

9 Comments

i wrote a code--
N=1000;
x=linspace(0,2,N);
f1=linspace(0,1,N/2);
f2=linspace(1,0,N/2);
f=[f1 f2];
subplot(2,1,1);
plot(x,f);
ft=fft(f);
subplot(2,1,2);
plot(x,ft);
but it doesn't make the proper graph of frequency domain. I just don't understand why it's not happening.
Type
doc fft
in your command window and look at the example; it will help you understanding how to plot the output of FFT (and you'll get the sinc^2 that you are looking for).
I'm at a computer without MATLAB at the moment. Sometimes fft gives a complex result. Try taking the real part of it with real(). Sometimes there is a big spike at zero so try taking the log of it before plotting. Also, you didn't pad with zeros so your triangle is really like a triangle wave rather than a pulse. Those are some things off the top of my head that you can try.
thank for your suggestion,, it's working now, at last
Hey can you post your code for fft of a triangular pulse
Thank you. I am trying to create a time-shifted triangular pulse with 16V peak amplitude
Is the fft of a triangular pulse square of sinc function
No. Since the fft of a rect function is a sinc, and two rects convolved with each other give a triangle, then the fft of a triangle will give the multiplication of the ffts of a single rect, in other words, it will be a sinc squared.
ft(rect) => sinc
rect ** rect => triangle
ft(triangle) = ft(rect ** rect) = ft(rect) * ft(rect) = sinc^2

Sign in to comment.

More Answers (1)

Find FOURIER TRANSFORM of triangular pulse x(t)= triang(t/2pi) using heaviside function. Pls solve stepwise and show.

1 Comment

This is not an answer to Tahiatul Islam's question (who hasn't even been here in 7 years).
If it's your question, see this link.

Sign in to comment.

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!