声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1882|回复: 4

[编程技巧] Inner matrix dimensions must agree 出错求助

[复制链接]
发表于 2007-11-25 17:34 | 显示全部楼层 |阅读模式

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

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

x
我在编MATLAB程序时候需要冲击周期信号的小程序,表达式为x=0.1*exp(-5*pi*t)*sin(10*pi*t)
我编写的程序为:
t=0:0.1:1
x=0.1*(exp(-5*pi*t))*(sin(10*pi*t))
plot(t,x)
一运行结果出现这个错误,??? Error using ==> *
Inner matrix dimensions must agree.
修改了几次都不行,请大家指教哪个地方错误了.谢谢

[ 本帖最后由 eight 于 2007-11-25 17:45 编辑 ]
回复
分享到:

使用道具 举报

发表于 2007-11-25 17:45 | 显示全部楼层
原帖由 mawens 于 2007-11-25 17:34 发表
我在编MATLAB程序时候需要冲击周期信号的小程序,表达式为x=0.1*exp(-5*pi*t)*sin(10*pi*t)
我编写的程序为:
t=0:0.1:1
x=0.1*(exp(-5*pi*t))*(sin(10*pi*t))
plot(t,x)
一运行结果出现这个错误,??? Error  ...

请到置顶贴中找答案
 楼主| 发表于 2007-11-25 17:53 | 显示全部楼层
谢谢答复,在你说帖子上找了一下,可能是太急了,没有找到,因为急用这个小程序,能不能详细指点一下哪个地方错误,谢谢!
发表于 2007-11-25 21:59 | 显示全部楼层
t=0:0.1:1;
x=0.1*(exp(-5*pi*t)).*(sin(10*pi*t));
plot(t,x)
注意中间的那个红点

[ 本帖最后由 home96 于 2007-11-25 22:05 编辑 ]
 楼主| 发表于 2007-11-26 08:56 | 显示全部楼层
谢谢,已经解决这个问题了.以下是我写的一个周期信号加 一个冲击振动,感觉写的很很麻烦,贴出来大家指点一下:
t1=0:0.01:5
x1=sin(0.2*pi*t1)
s1=0.2*exp(-5*t1).*sin(10*pi*t1)+x1
t2=5:0.01:10
x2=sin(0.2*pi*t2)
s2=0.2*exp(-5*(t2-5)).*sin(10*pi*(t2-5))+x2
t3=10:0.01:15
x3=sin(0.2*pi*t3)
s3=0.2*exp(-5*(t3-10)).*sin(10*pi*(t3-10))+x3
t4=15:0.01:20
x4=sin(0.2*pi*t4)
s4=0.2*exp(-5*(t4-15)).*sin(10*pi*(t4-15))+x4
t5=20:0.01:25
x5=sin(0.2*pi*t5)
s5=0.2*exp(-5*(t5-20)).*sin(10*pi*(t5-20))+x5
t6=25:0.01:30
x6=sin(0.2*pi*t6)
s6=0.2*exp(-6*(t6-25)).*sin(10*pi*(t6-25))+x6
plot(t1,s1,t2,s2,t3,s3,t4,s4,t5,s5,t6,s6)
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-5-10 10:53 , Processed in 0.050710 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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