RAPORT
despre lucrarea de laborator nr. 6
Varianta 13
A controlat: Andronic S.
CHIȘINĂU
2018
Sarcina lucrării:
I. . De calculat numeric integralele definite ordinare:
.
Rezolvare
I. a) >> quad('((x.^1/4+x).^3/2.*x.^3)',0,3)
ans =305.1060
b)>> quad('((z.^3+z.^2/3).^1/3)./((z.^4+1).^2)',1.5,4)
ans = 0.0158
r=dblquad(@int,2,3,1,2)
r =55.6170 - 1.6511i
r=triplequad(@int1,1,2,0,3,1,4)
r =1.4198e+03 - 2.0292e+01i
IV.
1)
function dxdt=sunshine(t,x);
dxdt=zeros(2,1);
omega0=20;
dxdt(1)=x(2);
dxdt(2)=-omega0^2*x(1);
x0=2; v0=5;
>> [t,x]=ode45(@sunshine,[0 10],[x0;v0]);
>> figure(1);
>> plot(t,x(:,1));
>> grid on ;
>> title('Oscilatii fortate fara rezistenta');
>> ylabel('Deplasarea x,cm');
>> xlabel('Timpul t,sec.');>>
Oscilatii fortate fara rezistenta
2.5
1.5
1
Deplasarea x,cm
0.5
-0.5
-1
-1.5
-2
-2.5
0 1 2 3 4 5 6 7 8 9 10
Timpul t,sec.
>> omega0=20;
>> A=sqrt(x0.^2+((v0.^2)./(omega0.^2)))
A = 2.0156
>> eps=atan((omega0*x0)/v0)
eps = 1.4464
>> T=(2*pi)/omega0
T = 0.3142
>> f=omega0/(2*pi)
f = 3.1831
2.a
function dxdt=sunshine2(t,x);
dxdt=zeros(2,1);
omega0=10;
h=0.4;
dxdt(1)=x(2);
dxdt(2)=-omega0^2*x(1)-2*h*x(2);
x0=2; v0=5;
>> figure(2)
>> plot(t,x(:,1));
>> grid on
ylabel('Deplasarea x,cm');
xlabel('Timpul t,sec.');
1.5
1
Deplasarea x,cm
0.5
-0.5
-1
-1.5
-2
0 1 2 3 4 5 6 7 8 9 10
Timpul t,sec.
>> omega0=10;
>> h=0.4;
>> omega=sqrt(omega0^2-h^2)
omega = 9.9920
>> a=sqrt(x0^2+(((v0+h*x0)^2)/omega^2))
a = 2.0825
>> eps=atan((omega*x0)/v0+h*x0)
eps = 1.3653
>> t=(2*pi)/omega
t = 0.6288
>> f=omega/2*pi
f = 15.6954
>> dec=exp(-h*t)
dec = 0.7776
>> declog=h*t
declog = 0.2515
2b.
function dxdt=sunshine3(t,x);
dxdt=zeros(2,1);
omega0=10;
h=10;
dxdt(1)=x(2);
dxdt(2)=-omega0^2*x(1)-2*h*x(2);
x0=2; v0=5;
>> figure(3)
>> plot(t,x(:,1));
grid on
ylabel('Deplasarea x,cm');
xlabel('Timpul t,sec.');
1.5
Deplasarea x,cm
0.5
-0.5
0 1 2 3 4 5 6 7 8 9 10
Timpul t,sec.
function dxdt=sunshine4(t,x);
dxdt=zeros(2,1);
omega0=10;
h=50;
dxdt(1)=x(2);
dxdt(2)=-omega0^2*x(1)-2*h*x(2);
>> figure(4)
>> plot(t,x(:,1));
grid on
ylabel('Deplasarea x,cm');
xlabel('Timpul t,sec.');
2
Deplasarea x,cm
1.5
0.5
0
0 1 2 3 4 5 6 7 8 9 10
Timpul t,sec.
3.a
function dxdt=sunshine5(t,x);
om0=13;
H0=0.5;
p=6;
dxdt=zeros(2,1);
dxdt(1)=x(2);
dxdt(2)=-om0.^2.*x(1)+H0.*sin(p.*t);
>> x0=2;
>> v0=5;
>> [t,x]=ode45(@sunshine5,[0 10],[x0;v0]);
>> figure(5)
>> plot(t,x(:,1),'-');
grid on
1.5
1
Deplasarea x,cm
0.5
-0.5
-1
-1.5
-2
-2.5
0 1 2 3 4 5 6 7 8 9 10
Timpul t,sec.
>> om0=13;
>> H0=5;
p=6;
A=H0/exp(om0^2-p^2)
A = 8.6657e-058
b) function dxdt=sunshine6(t,x);
om0=13;
H0=5;
p=12;
dxdt=zeros(2,1);
dxdt(1)=x(2);
dxdt(2)=-om0.^2.*x(1)+H0.*sin(p.*t);
>> figure(6)
>> plot(t,x(:,1),'-');
>> grid on
1.5
1
Deplasarea x,cm
0.5
-0.5
-1
-1.5
-2
-2.5
0 10 20 30 40 50 60 70 80 90 100
Timpul t,sec.
>> p=13;
A=H0/exp(om0^2-p^2)
A =5
3.c
function dxdt=sunshine7(t,x);
om0=13;
H0=5;
p=13;
dxdt=zeros(2,1);
dxdt(1)=x(2);
dxdt(2)=-om0.^2.*x(1)+H0.*sin(p.*t);
>> figure(7)
>> plot(t,x(:,1),'-');
Oscilatii fortate fara rezistenta
8
2
Deplasarea x,cm
-2
-4
-6
-8
0 5 10 15 20 25 30 35 40 45 50
Timpul t,sec.
>> grid on
xlabel('Timpul t,sec.');
A=H0/exp(om0^2-p^2)
A= 5
4)
function dxdt=sunshine8(t,x);
omega0=4;
H0=6;
p=7;
h=0.8
dxdt=zeros(2,1);
dxdt(1)=x(2);
dxdt(2)=H0*sin(p*t)-omega0^2*x(1)-2*h*x(2);
[t,x]=ode45(@ex4,[0,10],[1;0]);
A=H0/sqrt((omega0^2-p^2)^2+4*h^2+p^2)
A = 0.1777
defazaj=atan((2*h*p)/(omega0^2-p^2))
defazaj = -0.3272
p=[0:0.01:2*omega0];
A=H0./sqrt((omega0.^2-p.^2).^2+4*h.^2+p.^2);
plot(p,A)
grid on
gama=atan(2.*h.*p./(omega0.^2-p.^2));
plot(p,gama)
Concluzie: Integrarea numerică este una din aplicările cele mai importante ale pachetului MATLAB. În lucrarea de
laborator nr. 6 am aplicat metoda cuadraturilor, care permite de a calcula integrale simple şi duble prin metoda lui
Simpson sau metoda lui Gauss-Lobatto. Funcţia quad utilizează metoda lui Simpson şi poate fi mai efectivă când funcţiile
de sub integrală nu sunt line sau când precizia calcului, care se cere, este joasă.