Analitik M - File: 'K' 'Theta (Radian) ' 'Omega (Radians/sekon) '

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

ANALITIK

M_FILE
clear;
length=9.8;
g=9.8;
q=0.5;
F_Drive=1.2;
Omega_D=2/3;
npoints=150000000;
dt=0.04;
omega=zeros(npoints,1);
theta=zeros(npoints,1);
time=zeros(npoints,1);
theta(1)=0.2;
omega(1)=0;
for step = 1:npoints-1;
omega (step+1)=omega(step)+(-(g/length)*sin(theta(step))-q*omega(step)
+F_Drive*sin(Omega_D*time(step)))*dt;
temporary_theta_step_plus_1 = theta(step)+omega(step+1)*dt;
if (temporary_theta_step_plus_1<-pi)
temporary_theta_step_plus_1= temporary_theta_step_plus_1+2*pi;
elseif ( temporary_theta_step_plus_1>pi)
temporary_theta_step_plus_1= temporary_theta_step_plus_1-2*pi;
end;
theta(step+1)= temporary_theta_step_plus_1;
time(step+1)=time(step)+dt;
end;
I=find(abs(rem(time,2*pi/Omega_D))>0.02);
omega(I)=NaN;
theta(I)=NaN;
scatter(theta,omega,2);
plot(theta,omega,'k');
xlabel('theta(radian)');
ylabel('omega(radians/sekon)');
FIGURE

Grafik Bandul Analitik

0.5

omega(radians/sekon)

-0.5

-1

-1.5

-2
-4

-3

-2

-1

0
theta(radian)

M_FILE 2
%Program untuk melakukan perhitungan Euler_cromer untuk gerak bandul fisis
%dan menghitung diagram bifuraction diagram
Omega_D=2/3;
for F_Drive_step=1:0.3:13;
F_Drive=1.35+F_Drive_step/100;
[time,theta]= pendulum_function(F_Drive, Omega_D);
I=find(time<3*pi*300);
time(I)=NaN;theta(I)=NaN;
Z=find(abs(rem(time,2*pi/Omega_D))>0.01);
time(Z)=NaN;theta(Z)=NaN;
time(isnan(time))=[];
theta(isnan(theta))=[];
plot(F_Drive,theta,'r'); hold on;
axis([1.35 1.5 1 3]);
xlabel('F_Drive');
ylabel('theta(radians)');
end;
FIGURE

grafik pendulum bifuraction

2.8
2.6

theta(radians)

2.4
2.2
2
1.8
1.6
1.4
1.2
1
1.35

1.4

FDrive

1.45

M_FILE 3
function [time,theta]=pendulum_function(F_Drive,Omega_D)
length=9.8;
g=9.8;
q=0.5;
npoints=100000;
dt=0.04;
omega=zeros(npoints,1);
theta=zeros(npoints,1);
time=zeros(npoints,1);
theta(1)=0.2;
omega(1)=0;
for step = 1:npoints-1;
omega (step+1)=omega(step)+(-(g/length)*sin(theta(step))-q*omega(step)
+F_Drive*sin(Omega_D*time(step)))*dt;
temporary_theta_step_plus_1 = theta(step)+omega(step+1)*dt;
if (temporary_theta_step_plus_1<-pi)
temporary_theta_step_plus_1= temporary_theta_step_plus_1+2*pi;
elseif ( temporary_theta_step_plus_1>pi)
temporary_theta_step_plus_1= temporary_theta_step_plus_1-2*pi;
end;
theta(step+1)= temporary_theta_step_plus_1;

1.5

time(step+1)=time(step)+dt;
end;
plot(time,theta,'g'), title ('grafik pendulum bifuraction')
command windows
[time,theta]=pendulum_function(1.2,2/3)
FIGURE
grafik pendulum bifuraction

-1

-2

-3

-4

500

1000

1500

2000

2500

3000

3500

4000

PERBANDINGAN ANALITIK DAN NUMERIK


Command windows
>> l=1;
>> g=9.8;
>> t=0
>> t=0:0.4:10;
>> theta(1)=0.2;
>> omega=sqrt(g/l);
>> q=10;
>> theta=theta(1).*exp(-[q/2+sqrt((q^2/4)-omega.^2)*t]);
>> subplot(211)
>> plot(t,theta)
>> [time,theta]=ayu_pamb(10);
>> subplot(212)
>> plot(time,theta)
>>
FIGURE

grafik euler cromer gerak bandul teredam Q=1

0.2
0.18
0.16

Theta(radian)

0.14
0.12
0.1
0.08
0.06
0.04
0.02
0

5
Waktu(sekon)

10

10

0.2
0.18
0.16
0.14
0.12
0.1
0.08
0.06
0.04
0.02
0

You might also like