绘制连续信号 [英] Plotting a Continuous signal
本文介绍了绘制连续信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试按照下面的图像精确打印连续信号:
I am trying to exactly print a continuous signal as per image below:
下面是我的代码:
x=[0 0 0 1 1 1 1 1 1 -1 -1 0 0];
n=[6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 ];
subplot(2,2,2);
axis([min(n)-10,max(n)+10,min(x)-10,max(x)+10]);
plot(n,x);
grid on;
xlabel('Time');
ylabel('x2(t)');
title('Continous Signal');
但是输出图的数字与预期的不同:
But the output plot figure is not the same as per expectations:
难道在MATLAB中我们无法正确显示连续信号吗?如果是,我需要在代码中进行哪些更改.
Is it that in MATLAB we cannot display continuous signal properly? If yes what changes I need to make in my code.
为什么信号值不通过直线连接-它会形成曲线(或倾斜的直线)?
Why do the signal values are not connected via a straight line - it makes a curve (or slanted straight line)?
推荐答案
您正在寻找 stairs
函数:
x = [0 0 0 1 1 1 1 1 1 -1 -1 0 0];
n = [-6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 ];
stairs(n,x);
这篇关于绘制连续信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文