前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >专栏 >谐振子的动力学学运动

谐振子的动力学学运动

作者头像
巴山学长
发布2021-05-31 10:03:17
发布2021-05-31 10:03:17
65400
代码可运行
举报
文章被收录于专栏:巴山学长巴山学长
运行总次数:0
代码可运行

在力学的学习过程中经典分析力学是最基本的入门知识,过冷水之前和大家一起学习了两个小车通过弹簧链接起来的做来回摆动运动的运动轨迹学习。推文中直接给了一个微分方程组,然后解出微分方程组就得到了小车的演化轨迹。本期过冷水从零开始构建一个微分方程组,而不是单纯解微分方程。

假设有一个一维的谐振子在三维空间中做运动。m=5 kg;kx=2 N/m;ky=7 N/m;kz=4 N/m。

根据三维空间受力分析可得:

谐振子的势能函数为:

过冷水在这里需要给大家补充一点点初中弹簧做功的知识。W=Fr是做功的函数,已知F=kr;则W=kr2,而这里势能却是W=0.5kr2,这是因为错误使用W=Fr,该公式是恒力做功,而弹簧力是变力做功,需要使用积分来算功。

谐振子的动能为:

谐振子的总能量为:

谐振子的Lagrange函数为:

已知Lagrange方程方程形式:

Lagrange方程的证明较为复杂,在此过冷水只告诉打算使用了该方程而不证明方程的由来,感兴趣的可以找一本力学方面的书进行探究。Lagrange是一个微分方程,针对于我们的情况,可以很容易的就解出原函数。Lagrange方程的通解为:

设初始条件t=0时:

解得:

这样我们就求得了一个谐振子在三维空间的运动方程。可以得到如下的运动轨迹图

原始代码为:

代码语言:javascript
代码运行次数:0
运行
复制
clear
t=linspace(0,50,50000);
x=2.5*cos(sqrt(2/5)*t)+2*sqrt(5/2)*sin(sqrt(2/5)*t);
y=5*cos(sqrt(7/5)*t)+2*sqrt(5/7)*sin(sqrt(7/5)*t);
z=10*cos(sqrt(4/5)*t)+2*sqrt(5/4)*sin(sqrt(4/5)*t);
Coordiate=[x',y',z'];
[m,~]=find(Coordiate(:,1)==x(1)&Coordiate(:,2)==y(1)&Coordiate(:,3)==z(1))

figure1 = figure('Name','谐振子运动','NumberTitle','off','Color','w','Menubar','figure','WindowState','maximized');
subplot1 = subplot(2,2,1,'Parent',figure1);
view(subplot1,[-37.5 30]);
subplot2 = subplot(2,2,2,'Parent',figure1);
subplot3 = subplot(2,2,3,'Parent',figure1);
subplot4 = subplot(2,2,4,'Parent',figure1);
hold(subplot1,'on');
hold(subplot2,'on');
hold(subplot3,'on');
hold(subplot4,'on');
gg=1;
for k=1:length(t)
    %fill3([0 14 14 0],[0 0 14 14],[0 0 0 0],[0 1 1],'Parent',axes1);
    %hold(axes1,'on')plot3
    %fill3([0 14 14 0],[14 14 14 14],[0 0 14 14],[0 0 1],'Parent',axes1);
    %fill3([14 14 14 14],[0 0 14 14],[0 14 14 0],[1 0 0],'Parent',axes1);
    plot3(x(k),y(k),z(k),'Parent',subplot1,'MarkerFaceColor',[0 1 1],'MarkerEdgeColor',[0 1 1],'MarkerSize',3,'Marker','o','LineStyle','none');
    xlim(subplot1,[min(x)-1 max(x)+1]);
    ylim(subplot1,[min(y)-1 max(y)+1]);
    zlim(subplot1,[min(z)-1 max(z)+1]);
    box(subplot1,'on');
    ylabel(subplot1,'$Y$','FontSize',20,'Interpreter','latex');
    xlabel(subplot1,'$X$','FontSize',20,'Interpreter','latex');
    zlabel(subplot1,'$Z$','FontSize',20,'Interpreter','latex');
    title(subplot1,'三维空间轨迹图','FontSize',20,'FontName','楷体');
    
    plot(t(k),z(k),'Parent',subplot2,'MarkerFaceColor',[0 1 1],'MarkerEdgeColor',[0 1 1],'MarkerSize',10,'Marker','o','LineStyle','none');
    ylim(subplot2,[min(z)-1 max(z)+1]);
    xlim(subplot2,[min(t)-2 max(t)+2])
    box(subplot2,'on');
    xlabel(subplot2,'$T$','FontSize',20,'Interpreter','latex');
    zlabel(subplot2,'$Z$','FontSize',20,'Interpreter','latex');
    title(subplot2,'TZ图','FontSize',20,'FontName','楷体');
    
    
    plot(t(k),x(k),'Parent',subplot3,'MarkerFaceColor',[0 1 1],'MarkerEdgeColor',[0 1 1],'MarkerSize',10,'Marker','o','LineStyle','none');
    ylim(subplot3,[min(x)-1 max(x)+1]);
    xlim(subplot3,[min(t)-2 max(t)+2])
    box(subplot3,'on');
    xlabel(subplot3,'$T$','FontSize',20,'Interpreter','latex');
    zlabel(subplot3,'$X$','FontSize',20,'Interpreter','latex');
    title(subplot3,'TX图','FontSize',20,'FontName','楷体');
    
    plot(t(k),y(k),'Parent',subplot4,'MarkerFaceColor',[0 1 1],'MarkerEdgeColor',[0 1 1],'MarkerSize',10,'Marker','o','LineStyle','none');
    ylim(subplot4,[min(y)-1 max(y)+1]);
    xlim(subplot4,[min(t)-2 max(t)+2])
    box(subplot4,'on');
    xlabel(subplot4,'$T$','FontSize',20,'Interpreter','latex');
    zlabel(subplot4,'$Y$','FontSize',20,'Interpreter','latex');
    title(subplot4,'TY图','FontSize',20,'FontName','楷体');
    fmat(:,k)=getframe;           %拷贝祯到矩阵fmat中
    im = frame2im(getframe);
    [I,map] = rgb2ind(im,256);
    if gg == 1
        imwrite(I,map,'lxx.gif','GIF', 'Loopcount',inf,'DelayTime',0.05);
        gg = gg + 1;
    else
        imwrite(I,map,'lxx.gif','WriteMode','append','DelayTime',0.05);
    end
end
movie(fmat,1)

根据轨迹图像可以看出谐振子在三维空间中运动轨迹很复杂。这只是动力学上比较简单一个运动问题。过冷水要带大家做的是有很多个相互作用的空间运动问题。不积跬步无以至千里,本期先和大家分享这个简单的案例,下期带大家了解两个谐振子的一维运动图像。想要深入了解学习请持续关注过冷水的推文。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2021-05-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 巴山学长 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档