Graph Simple Pulse function in matlab HELPPPPPPPPPPPPP PLEASE

Consider a pulse function of time duration 0 to T which is half of a sine wave:
x(t) = 0 t < 0
x(t) = Asin(pi*t/T) 0 < t < T
x(t) = 0 t > T
Calculate the Fourier transform of this pulse. For A=1 and T=1 (sec) plot the magnitude of X(f) versus f.
*I just need the matlab code. Thank you****

댓글 수: 2

Just the MATLAB code? You mean we can skip the comments and the descriptions of what we are doing and you promise not to ask questions about how it works?
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

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

 채택된 답변

Walter Roberson
Walter Roberson 2012년 3월 12일
Just the MATLAB code.
f = linspace(-50,50,301);
t1 = pi .^ 2;
t4 = -pi - (2 .* f);
t5 = exp((-1*i) .* t4);
t12 = exp((i) .* (f + pi ./ 0.2e1));
t17 = sqrt((0.2e1 .* t1) + t1 ./ t12 .* ((i) + (-1*i) .* t5));
t18 = f .^ 2;
t20 = abs(-0.2e1 .* t1 + (2 .* t18));
t23 = 2 ./ t20 .* t17;
plot(f, t23);

댓글 수: 2

Perhaps the OP does not ask for details. I promise, I will not ask, too.
Btw, the code works well, if you rename all "t4" to "t2".
The calculation was a bit on the Heavy Side.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by