필터 지우기
필터 지우기

Plotting a fourier transform graph

조회 수: 13 (최근 30일)
Nazarudin Iqzuan Marzulino
Nazarudin Iqzuan Marzulino 2021년 1월 24일
댓글: Star Strider 2021년 1월 24일
syms t;
f=t*rectangularPulse(t/2);
F=fourier(f);
Hello, above are the main coding I used for my fourier transform, I'm trying to plot a fourier transform graph, but everytime I tried it either gives a blank graph or sometimes a graph with horizontal line.
I had tried to use plot() and ezplot() but it gives error as I don't have much understanding, I watched youtube videos but still dont understand. I also tried using fplot() but it gives empty graph. I tried a lot of ways through trials and errors but not successful result.

채택된 답변

Star Strider
Star Strider 2021년 1월 24일
Try this:
syms t w
f(t)=t*rectangularPulse(t/2);
F(w)=fourier(f,t,w);
figure
fplot(real(F), [-50 50])
hold on
fplot(imag(F), [-50 50])
fplot(abs(F), [-50 50], 'LineWidth',1.5)
hold off
grid
legend('\Re(F)', '\Im(F)', '|F|')
.
  댓글 수: 4
Nazarudin Iqzuan Marzulino
Nazarudin Iqzuan Marzulino 2021년 1월 24일
Thank you!! Although it seems like a stupid/easy question, but your answer is really beneficial!
Star Strider
Star Strider 2021년 1월 24일
As always, my pleasure!
Thank you!
It was not a ‘stupid’ question by any interpretation, if my clarifying it helped you understand why I wrote my code as I did! That is how we all learn.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by