mawens 发表于 2007-11-25 17:34

Inner matrix dimensions must agree 出错求助

我在编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 编辑 ]

eight 发表于 2007-11-25 17:45

原帖由 mawens 于 2007-11-25 17:34 发表 http://www.chinavib.com/forum/images/common/back.gif
我在编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...
请到置顶贴中找答案

mawens 发表于 2007-11-25 17:53

谢谢答复,在你说帖子上找了一下,可能是太急了,没有找到,因为急用这个小程序,能不能详细指点一下哪个地方错误,谢谢!

home96 发表于 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 编辑 ]

mawens 发表于 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)
页: [1]
查看完整版本: Inner matrix dimensions must agree 出错求助