FFT of various signals

5 views (last 30 days)
Randy Marsh
Randy Marsh on 25 Apr 2017
Determine an amplitude spectrum of a triangular signal using FFT, with duration 1ms and amplitude 2V, such that a signal has as clean as possible spectrum. Determine the energy of a signal using Parseval's theorem.
Here is the code:
dt=.001;
t=[-100:dt:100];
%x=(5/2)*(sign(t+10)-sign(t-10));
x=0.5*max(10-abs(t),0); %Triangular signal
%subplot(2,2,1);
plot(t,x);
title('Rectangular pulse with width 10ms');
xlabel('time(ms)');
ylabel('Amplitude(V)');
axis([-25 25 0 6]);
y=fftshift(fft(x)); % moving the zero-frequency component to the center of the array
N=length(y); %to take the frquecny axis of the hoarmonics.
n=-(N-1)/2:(N-1)/2; %divide the frequency compone
f=sqrt(y.*conj(y)); % to take the amplitude of each hoarmony.
title('Rectangular pulse amplitude');
xlabel('frequency component(harmoney)');
ylabel('Amplitude of the harmoney');
plot(n,f);
axis([-50 50 0 150000]);
y=fftshift(fft(x)); % moving the zero-frequency component to the center of the array
N=length(y); %to take the frquecny axis of the hoarmonics.
n=-(N-1)/2:(N-1)/2; %divide the frequency compone
f=sqrt(y.*conj(y)); % to take the amplitude of each hoarmony.
title('Rectangular pulse amplitude');
xlabel('frequency component(harmoney)');
ylabel('Amplitude of the harmoney');
plot(n,f);
axis([-50 50 0 150000]);
Energy = sum(abs(x).^2);
disp(Energy);
Don't mind Rectangular in code. Now, how to provide that a signal has as clean as possible spectrum?
How to modify this code such that a signal is trapezoidal, such that it a signal has as small as possible leakage of spectrum.
Also, if a signal is s(t)=2sin(2πf1t+π/6)+ 3sin(2πf2t+π/3)+ 4sin(2πf3t+π/2) for f1=200Hz, f2=300Hz, f3=400Hz such that it a signal has as small as possible leakage of spectrum. Determine the power of a signal.
Here, I don't understand how to evaluate the power. Is it P=E/t or P=E/dt?

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!