声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1517|回复: 2

[编程技巧] 初学者,问李萨如图。

[复制链接]
发表于 2009-3-9 07:22 | 显示全部楼层 |阅读模式

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

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

x
%
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.

这学期才上机械振动学,老师安排了一个编程作业。
回复
分享到:

使用道具 举报

发表于 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 编辑 ]
 楼主| 发表于 2009-3-10 22:02 | 显示全部楼层

回复 沙发 ChaChing 的帖子

thanks~~
我试试。
这一两天才接触MATLAB,靠着学过的C语言底子,加上网上找回来的教程,拼凑出来的程序…
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-10-1 15:22 , Processed in 0.069660 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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