필터 지우기
필터 지우기

I need to repeat a periodic signal

조회 수: 7 (최근 30일)
ALOUI
ALOUI 2023년 11월 8일
댓글: Walter Roberson 2023년 11월 11일
The function is
f(t) = -t/2 if -2<=t<0
f(t) = t if 0<=t<1
f(t) = 1 if 1<=t<2
The periode is 4
and it has to be repeated from -10 to 10

답변 (2개)

Image Analyst
Image Analyst 2023년 11월 8일
This looks like a homework problem. If you have any questions ask your instructor or read the link below to get started:
Obviously we can't give you the full solution because you're not allowed to turn in our code as your own.
Hint: linspace to generate t, and repmat to make additional copies of a vector.
Use masking to get the ranges of indexes for t and don't use (t) when assigning f, use the mask, like
t = linspace(..................); % You finish it
f = zeros(1, numel(t)); % Initialize
indexesToAssign = (-2 <= t) & (t < 0); % Get logical vector (mask) of where these indexes are.
f(indexesToAssign) = -t/2;
% Similar for the two other ranges.

Walter Roberson
Walter Roberson 2023년 11월 8일
Hint:
syms t
F(t) = piecewise(-2 <= t & t < 0, 1, 0 <= t & t < 1, 2, 1 <= t & t < 2, 3)
F(t) = 
fplot(F, [-10 10]); ylim([-1 4])
G = F(mod(t,4)-2)
G = 
fplot(G, [-10 10]); ; ylim([-1 4])
This tells us that if you can construct f(t) for one period of t, then you can extend it to an indefinite number of periods using mod
  댓글 수: 3
Paul
Paul 2023년 11월 11일
I don't think the expression for G is correct. G should overlay F in the range -2<t<2.
syms t
F(t) = piecewise(-2 <= t & t < 0, 1, 0 <= t & t < 1, 2, 1 <= t & t < 2, 3);
G(t) = F(mod(t,4)-2);
figure
fplot([G F],[-10 10],'ShowPoles','off')
ylim([0 4])
Walter Roberson
Walter Roberson 2023년 11월 11일
Good catch, @Paul
syms t
F(t) = piecewise(-2 <= t & t < 0, 1, 0 <= t & t < 1, 2, 1 <= t & t < 2, 3);
G(t) = F(mod(t+2,4)-2);
figure
fplot([G F],[-10 10],'ShowPoles','off')
ylim([0 4])

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

카테고리

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

제품


릴리스

R2012b

Community Treasure Hunt

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

Start Hunting!

Translated by