matlab用stem画出𝑥(𝑛) = (0.6)^𝑛𝑢(𝑛)卷积h(𝑛) = (−0.9)^𝑛𝑢(𝑛)的序列图像,将𝑛 ∈ [0, 70]和𝑛 ∈ [1, 35]的卷积图像用不同的颜色画在同一张图像里
时间: 2024-05-14 18:14:11 浏览: 19
首先,我们需要定义两个序列:
```
n = 0:70;
x = (0.6).^n .* (n>=0);
h = (-0.9).^n .* (n>=0);
```
然后,我们可以使用`conv`函数计算卷积:
```
y = conv(x,h);
```
最后,我们可以使用`stem`函数画出序列图像:
```
figure;
stem(n,x,'filled','MarkerSize',4);
hold on;
stem(n,h,'filled','MarkerSize',4);
stem(0:length(y)-1,y,'filled','MarkerSize',4);
stem(1:length(y),y,'filled','MarkerSize',4);
hold off;
xlim([0 70]);
xlabel('n');
ylabel('Amplitude');
legend('x(n)','h(n)','y(n) n\in[0,70]','y(n) n\in[1,35]');
```
其中,`xlim`函数用于设置x轴范围,`xlabel`和`ylabel`函数用于设置坐标轴标签,`legend`函数用于设置图例。
完整代码如下:
```
n = 0:70;
x = (0.6).^n .* (n>=0);
h = (-0.9).^n .* (n>=0);
y = conv(x,h);
figure;
stem(n,x,'filled','MarkerSize',4);
hold on;
stem(n,h,'filled','MarkerSize',4);
stem(0:length(y)-1,y,'filled','MarkerSize',4);
stem(1:length(y),y,'filled','MarkerSize',4);
hold off;
xlim([0 70]);
xlabel('n');
ylabel('Amplitude');
legend('x(n)','h(n)','y(n) n\in[0,70]','y(n) n\in[1,35]');
```
相关推荐
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)