I need to repeat a periodic signal
조회 수: 7 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (2개)
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.
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.
댓글 수: 0
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)
fplot(F, [-10 10]); ylim([-1 4])
G = F(mod(t,4)-2)
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
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
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 Center 및 File Exchange에서 Number Theory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!