FT and Amplitude Phase plot in matlab
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
swlinas
am 11 Jun. 2022
Bearbeitet: swlinas
am 17 Jun. 2022
The function I need to find the fourier transform of is: x = (t-5)^2/e^8t , t>5
and I want to plot the amplitude spectrum.
This is the code I've written so far but it doesn't seem to work properly.
%%%%
x2 = ((t-5)^2)/exp(8*t);
x2_FT = fourier(x2);
w_values=-100:100;
X_values=double(subs(x2_FT,w,w_values));
subplot(2,1,1)
fplot(t,x2,'-b'); hold on; title('Signal'); grid on;
subplot(2,1,2)
plot(w_values, abs(X_values),'*'); title('Amplitude Plot'); grid on;
%%%%
Also any help on how to actually solve the fourier transform of the above mentioned function will be greatly appreciated.
Thanks in advance!
3 Kommentare
Akzeptierte Antwort
Star Strider
am 11 Jun. 2022
Try this —
syms t w
x2 = ((t-5)^2)/exp(8*t)
x2_FT = int(x2*exp(-1j*w*t), t, -1, 1)
figure
fplot(real(x2_FT), [-100 100])
hold on
fplot(imag(x2_FT), [-100 100])
fplot(abs(x2_FT), [-100 100], '-g', 'LineWidth',2)
hold off
grid
legend('Re(x2\_FT)','Im(x2\_FT)','|x2\_FT|', 'Location','best')
% x2_FT = fourier(x2)
w_values=-100:100;
X_values=double(subs(x2_FT,w,w_values));
figure
subplot(2,1,1)
fplot(t,x2,'-b'); hold on; title('Signal'); grid on;
subplot(2,1,2)
plot(w_values, abs(X_values),'*'); title('Amplitude Plot'); grid on;
I find that is occasionally necessary to do the specific integration to get the desired Fourier transform rather than using the fourier function.
.
6 Kommentare
Paul
am 12 Jun. 2022
How are the results essentially the same? In the first case, with the integration taken over [-1,1], the amplitude plot peaks at ~12000, but with the integration over [0,5] it peaks at 3. And the plots of the Re and Im parts don't seem to be essentially the same either, with lots of osciallations in the former and none in the latter.
But the bigger question is, what is the justification for these seemingly arbitrary limits of integration, neither of which seem to comport with the definition of the Fourier transform integral as it would apply to this function?
Using the limits of [-1,1] implies that x2(t) is zero outside that interval, and using [0,5] implies x2(t) is zero outside of that interval. But neither of those implications is true for x2(t).
Weitere Antworten (1)
Paul
am 11 Jun. 2022
The code as shown has at least two issues. When using symbolic math, need to declare variables appropriately
syms t w real
Because x2 is zero for t < 5 (not stated explicilty, but implied by the question), need to multiply by heaviside
x2(t) = ((t-5)^2)/exp(8*t)*heaviside(t-5);
figure
fplot(x2,[0 10])
xlabel('t');ylabel('x2')
Perhaps the solution can be obtained starting from here ....
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!