albertleung 发表于 2009-3-9 07:22

初学者,问李萨如图。

%
n=1;
while n <=10,
figure('name','阻尼谐振动的合振动轨迹 design by Albert Leung');
phy =0;
while phy <=pi,
fx=1;
fy=n * fx;
t =linspace(0,1,100);
x =20 *sin(2 *pi *fx *t) *exp(-t);
y =20 *sin(2 *pi *fy *t+phy) *exp(-t);
grid on;
subplot (4,4,fignum) ;plot(x,y) ;
phy = phy+pi/16;
fignum=fignum+1;
end;
pause(1);
n=n+1;
end;
phy=phy+pi/16;
fignum=fignum+1;
end;
pause(4);
n=n+1;
end;
%

结果,
Error using ==> mtimes
Inner matrix dimensions must agree.

这学期才上机械振动学,老师安排了一个编程作业。

ChaChing 发表于 2009-3-9 08:03

1.x =20 *sin(2 *pi *fx *t) *exp(-t);出错
2.好像两个多馀end
3. ...错很多地方
建议利用matlab的优点(逐行执行!), 并看下
http://forum.vibunion.com/forum/viewthread.php?tid=46001&highlight=%2Beight

[ 本帖最后由 ChaChing 于 2009-3-9 08:06 编辑 ]

albertleung 发表于 2009-3-10 22:02

回复 沙发 ChaChing 的帖子

thanks~~
我试试。
这一两天才接触MATLAB,靠着学过的C语言底子,加上网上找回来的教程,拼凑出来的程序…
页: [1]
查看完整版本: 初学者,问李萨如图。