How to run this code with some values of k?

조회 수: 1 (최근 30일)
RoBoTBoY
RoBoTBoY 2020년 12월 4일
답변: VBBV 2020년 12월 4일
Hello!
I have this:
I run this code:
syms t
k = 0;
x(t) = 3*dirac(t-3*k*pi)+2*dirac(t-3*k*pi-pi)+dirac(t-3*k*pi-2*pi)
f = abs(fourier(x));
a = angle(fourier(x));
subplot(2,1,1)
fplot(f, [-5 5])
grid on
ylabel('Magnitude')
subplot(2,1,2)
fplot(a, [-2 2])
grid on
ylabel('Phase')
xlabel('Angular frequency(ω)')
How to choose some values of k, which is an integer, for example from -5 to 5?
  댓글 수: 1
RoBoTBoY
RoBoTBoY 2020년 12월 4일
I used for example k=0. Can I run the above code for some values of k at once? Or I must run the code 11 times for each value of k for example -5 to 5.

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

채택된 답변

VBBV
VBBV 2020년 12월 4일
%true
syms t k
F= @(t,k) 3*dirac(t-3*k*pi)+2*dirac(t-3*k*pi-pi)+dirac(t-3*k*pi-2*pi)
f = abs(fourier(F,t,k));
a = angle(fourier(F,t,k));
subplot(2,1,1)
fplot(f,[-5 5])
grid on
ylabel('Magnitude')
subplot(2,1,2)
fplot(a,[-5 5])
grid on
ylabel('Phase')
xlabel('Angular frequency(ω)')
Try the above

추가 답변 (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