matlab_distillation_column

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Q2)

In the small-angle approximation, the motion of a simple pendulum is approximated by simple harmonic motion. String of length with gravitational acceleration g, mass M then acceleration.

Where I is the moment of inertia in this case . To solve this equation convert to two first order equations.

I=12 kgm2, M=3 kg, g=9.8 ms-2 solution set can get from following code.

M-files name is shown in top row

First m- file

%----------------Parameters.m--------------------------

% This is a M file for parameters of the equations

g=9.8;

I=12;

M=3;

%I=M*R*R

R=sqrt(I/M);

%---------------------END------------------------------

Second m- file

%------------pendulum.m--------------------------

%--Function for put equation into matlab---------

function dqdt=pendulum(t,y)

Parameters;

%here y is metrix y(1)=w ,and y(2)=angale

dqdt=[y(2);-M*g*R*sin(y(1))/I];

%------------END----------------------------------

Last m- file

%----------solution_pendulum.m-----------------------------

inital_condition=[pi/2,0];

time_span=[0 10];

[t,y]=ODE45(@pendulum,time_span,inital_condition);

subplot(2,1,1)

plot(t,y(:,1),'r')

xlabel('Time');

ylabel('Angle in radian');

title('Time vs Angle in radian')

grid on

subplot(2,1,2)

plot(t,y(:,2),'b')

xlabel('Time');

ylabel('Angle velocity');

title('Time vs Angle velocity')

grid on

%-----------------END--------------------------------------

相关文档
最新文档