Example:
For y = e-x + 1 with x between -2 and 2, plot the continuous y curve and discrete stem diagram.
x = -2:0.1:2;
y = exp(-x)+1;
subplot(211);
plot(x,y);
xlabel('x');ylabel('y');title('y = exp(-x)+1');
subplot(212);
stem(x,y);
xlabel('x');ylabel('y');title('discrete x');
Result:
References:
stem - plot discrete sequence data (MathWorks)
Matlab: Unit Impulse δ[n] 單位脈衝函數
沒有留言:
張貼留言