用matlab做单摆,单摆模型MATLAB程序
《單擺模型MATLAB程序》由會員分享,可在線閱讀,更多相關《單擺模型MATLAB程序(2頁珍藏版)》請在人人文庫網上搜索。
1、Simple pendulum model%All rights reserved%說明,本程序演示了鐘擺擺動過程,并同時給出簡寫振動方程%代碼由董燦生編寫,所有權利保留%時間2012年11月7日%Start%clear%重力加速度g=9.81;%Kgm/S2%擺長l=1.8;%m%初相位phi_0=pi/2;%擺的質量m=1;%Kgtheta_m=pi/3;%最大擺角%圓頻率w=sqrt(g/l);%周期T=2*pi/w;%時間向量t=0:0.05:m*T;%簡諧方程theta=theta_m*cos(w*t+phi_0);%小球x坐標x=l*sin(theta);%小球y坐標y=l-l*c。
2、os(theta);%以下為演示程序代碼figurehold onm,n=size(x);plot(t,theta);plot(x,y);xlabel(length and time);ylabel(theta and height);title(simple pendulum model);plot(0,l,b+);% grid onfor i=1:nh(1)=plot(0,x(i),l,y(i);h(2)=plot(x(i),y(i),ro);h(3)=plot(t(i),theta(i),gd);pause(0.1)if i=ndelete(h);endpause(0.1)endhold off%The end。
總結
以上是生活随笔為你收集整理的用matlab做单摆,单摆模型MATLAB程序的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php设置背景为透明,css如何设置背景
- 下一篇: laravel模板写php代码,Lara