Plot the signals y(t)=sin(8πt) and g(t)=sin(18πt). Then sample both with a sampling period of 1/13s. Sketch the discrete signals. What do you observe?
조회 수: 7 (최근 30일)
이전 댓글 표시
I was given this problem and so far, this is what I've done
t = [0:0.1:13]
y = sin(8*pi*t);
g = sin(18*pi*t)
plot(t,y,'color','r'); hold on;
plot(t,g,'color','b');
What I'm really confused on is the sampling period and sketching the discrete signals. Did I implement the sampling time correctly in t? Is there a way to create a discrete signal?
Thank you.
댓글 수: 0
답변 (3개)
J. Webster
2016년 7월 20일
편집: J. Webster
2016년 7월 20일
Since t is an array, and you want y and g to be arrays, you need to use the . notation for operations...
so for example, replace
18*pi*t
with
18.*pi.*t
댓글 수: 0
Star Strider
2016년 7월 20일
The ‘1/13s’ I believe should be the step in your ‘t’ vector.
This is how I interpret the problem:
tlim = 1;
tc = linspace(0, tlim, 250);
t = [0:(1/13):tlim];
y = @(t) sin(8*pi*t);
g = @(t) sin(18*pi*t);
figure(1)
subplot(2,1,1)
plot(tc,y(tc),'-r', tc,g(tc),'-b');
grid
subplot(2,1,2)
plot(t,y(t),'-r', t,g(t),'-b');
grid
That’s an impressive illustration of the phenomenon the problem is asking you to observe. (I made ‘y’ and ‘g’ anonymous functions for convenience.)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Labels and Styling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!