|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
matlab解动力方程:M*d2y+C*dy+K*y=F :
先编写程序odex2.m
function ydot=odex2(t,y)
ydot=zeros(12,1);
y(1)=ydot(1:6); %前六项对应6个y,也就是位移
y(2)=ydot(7:12);%后六项对应6个y的一阶导数,也就是速度
ydot=[y(2);M\(F-K*y(1)-C*y(2))];
然后运行:
y0=zeros(12,1);
tspan=[0,0.02];
[t,y]=ode45('odex2',tspan,y0);
plot(t,y)
怎么运行不出来呢?新手上路,拜托各位帮忙!
其中M=
Columns 1 through 3
0.179338444948704 0 0
0 0.199834267228556 0.00284635731911443
0 0.00284635731911443 5.22694707691923e-005
0.0896692224743521 0 0
0 0.0691734001945002 0.00168193841584035
0 -0.00168193841584035 -3.92021030768942e-005
Columns 4 through 6
0.0896692224743521 0 0
0 0.0691734001945002 -0.00168193841584035
0 0.00168193841584035 -3.92021030768942e-005
0.179338444948704 0 0
0 0.199834267228556 -0.00284635731911443
0 -0.00284635731911443 5.22694707691923e-005
K=
Columns 1 through 3
1076785822.59454 972607.102196906 65504.3893684949
972607.102196906 210697053.60339 10632748.1072992
65504.3893684949 10632748.1072992 716107.943798101
-1076785822.59454 -972607.102196906 -65504.3893684949
-972607.102196906 -210697053.60339 -10632748.1072992
32728.9279533926 10647654.3066432 357799.615039121
Columns 4 through 6
-1076785822.59454 -972607.102196906 32728.9279533926
-972607.102196906 -210697053.60339 10647654.3066432
-65504.3893684949 -10632748.1072992 357799.615039121
1076785822.59454 972607.102196906 -32728.9279533926
972607.102196906 210697053.60339 -10647654.3066432
-32728.9279533926 -10647654.3066432 717613.469931842
C=
Columns 1 through 3
186648.781973481 168.589769791428 11.35439983835
168.589769791428 36522.7877169709 1843.07327564183
11.35439983835 1843.07327564183 124.128975515427
-186647.460240501 -168.589769791428 -11.35439983835
-168.589769791428 -36521.4659839905 -1843.05102647
5.67316691058422 1845.63483725052 62.0200770245852
Columns 4 through 6
-186647.460240501 -168.589769791428 5.67316691058422
-168.589769791428 -36521.4659839905 1845.63483725052
-11.35439983835 -1843.05102647 62.0200770245852
186648.781973481 168.589769791428 -5.67316691058422
168.589769791428 36522.7877169709 -1845.65708642235
-5.67316691058422 -1845.65708642235 124.389940404259
F =
-0.256890196210371
-51.6604178422184
-2.60639822396588
0.219881672759549
51.6234093187675
-2.60942875559811 |
|