声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1266|回复: 3

[绘图技巧] matlab图像出现错误

[复制链接]
发表于 2012-10-31 00:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
clear;close all;
Nx=20;Nh=10;m=5; %设定 Nx,Nh和位移值m
n=0:Nx-1;
x1=(0.9).^n;%产生x1(n)
x2=zeros(1,Nx+m);
for k=m+1:m+Nx
    x2(k)=x1(k-m);
end
nh=0:Nh-1;h1=ones(1,Nh);%产生h1(n)
h2=h1;
y1=conv(x1,h1);%计算y1(n)=x1(n)*h1(n)
y2=conv(x2,h2);%计算y2(n)=x2(n)*h2(n)
subplot(3,2,1);stem(n,x1,'.');
xlabel('n');ylabel('x1(n)');
axis([0,Nx+Nh-1,0,1]);
subplot(3,2,3);stem(nh,h1,'.');
xlabel('n');ylabel('h1(n)');
axis([0,Nh+Nx-1,0,1]);
subplot(3,2,5);stem(n,y1,'.');
xlabel('n');ylabel('y1(n)');
axis([0,Nx+Nh-1,0,6]);
subplot(3,2,2);stem(n,x2,'.');
xlabel('n');ylabel('x2(n)');
axis([0,34,0,1]);
subplot(3,2,4);stem(nh,h2,'.');
xlabel('nh');ylabel('h2(n)');
axis([0,34,0,1]);
subplot(3,2,6);stem(n,y2,'.');
xlabel('n');ylabel('y2(n)');
axis([0,34,0,6]);

点评

反对: 5.0
反对: 5
这样子发帖,只发代码,也不描述具体是什么问题,对你获得帮助信息是不利的  发表于 2012-10-31 09:46
回复
分享到:

使用道具 举报

发表于 2012-11-30 10:04 | 显示全部楼层
  1. m=5;
复制代码
分号应该是半角的
  1. subplot(3,2,5);stem(n,y1,'.');
复制代码
n和y1的长度不一致

后续错误类似

评分

1

查看全部评分

 楼主| 发表于 2012-11-30 18:17 | 显示全部楼层
发表于 2012-12-4 17:43 | 显示全部楼层
错误提示是啥呀,要善于看那个

评分

1

查看全部评分

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-30 01:27 , Processed in 0.053348 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表