FT and Amplitude Phase plot in matlab
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
Star Strider
2022년 6월 11일
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
Paul
2022년 6월 12일
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).
추가 답변 (1개)
Paul
2022년 6월 11일
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 ....
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!