How do I go about plotting the following function?
1 次查看(过去 30 天)
显示 更早的评论
The function I want to plot is x[n] = \delta[n] - \delta[n-a] where a is just a number.
I know about plotting the impulse function on it's own but this doesn't make any sense to me.
Any and all help is appreciated.
回答(1 个)
John Doe
2019-10-9
编辑:John Doe
2019-10-10
I've used random numbers.
a = 5
n = [1:1:50]';
delta = 10;
x(n,1) = delta - (delta*(n-a))
plot(x,n)
Alternatively, you could leave n as it is without transposing and plot per the below:
a = 5
n = 1:1:50;
delta = 10;
x(n,1) = delta - (delta*(n-a))
plot(x(:,1),n(1,:))
It doesn't make much odds.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Formatting and Annotation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!