Sunteți pe pagina 1din 12

1.

De calculat numeric integralele definite ordinare:


1
3 4
3
3 1(𝑦𝑦 4/3 + 𝑦𝑦)5 𝑑𝑑𝑑𝑑
� 𝑢𝑢 (𝑢𝑢 + 2) 𝑑𝑑𝑑𝑑 ; �
4 3
0.2 0.2 (𝑦𝑦 2 + 1)
File name: integr6.m

function y = integr6(u);
y = (u.^3/4)*(u.^3+2)^1/3;

File name: main.m

result = quad(@integr6,0.2,3)

Result:
result = 29.411

File name: integr6.m

function x = integr6(y);
x = ((y.^4/3+y).^1/5)/(y.^2+1);
File name: main.m

result = quad(@integr6,0.2,4)

Result:
result = 1.5233

Ex.2 De calculat numeric integrala definită dublă folosind file-funcţia respectivă:

2. De calculat numeric integrala definită dublă folosind file-funcţia respectivă:


3 2
1� 7� 1�
� � [3𝑥𝑥 3 + 𝑦𝑦 3 + 4𝑥𝑥𝑥𝑥 cos(𝑥𝑥)] 𝑥𝑥 3 𝑦𝑦 5 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑
1 0.5

File name: integr6.m

function y = integr6(x,y);
y = ((3.*x).^3 + y.^1/3 + (4.*x.*y).*cos(x)).*((x.*7/3).*(y.^1/5));
File name: main.m

result=dblquad(@integr6,0.5,1,2,3)
Result:
result = 8.8435
3. De calculat numeric integrala triplă folosind file-funcţia respectivă
3 4 5
1� 1 1�
� � � [3𝑥𝑥 3 + 𝑦𝑦 3 4𝑦𝑦𝑦𝑦 cos(𝑧𝑧)] 𝑥𝑥 �3 𝑧𝑧 3 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑
2 3 4

1
File name: integr6.m

function f = integr6(x,y,z);
f = ((3.*x).^3 + (y.^1/3).*4.*y.*z.*cos(z)).*(x.^1/3).*(z.^1/3);
File name: main.m

result = triplequad(@integr6,4,5,3,4,2,3)

Result:
result = 3109.5
4. De scris şi de rezolvat numeric ecuaţia diferenţială a oscilaţiilor rectilinii ale punctului material. Parametrii
sistemului mecanic se aleg desinestătător în mod aleatoriu. De construit graficul dependenţei parametrului de
poziţie ( x=x(t) ) şi de determinat caracteristicile dinamice ale mişcărilor respective (vezi anexa nr.5 la pag. 164-
165):
a). Oscilaţiile libere în lipsa rezistenţei mediului.
b). Oscilaţiile libere în prezenţa rezistenţei mediului.
c). Oscilaţiile forţate în lipsa rezistenţei mediului
d). Oscilaţiile forţate în prezenţa rezistenţei
Rezolvare:
a)
Function Name: diferentiala.m

function dxdt = diferentiala(t,x)


w0 = 11;
dxdt = zeros(2,1)
dxdt(1) = x(2);
dxdt(2) = -w0^2*x(1);
File Name = Main.m

[t,x] = ode15s(@diferentiala,[0 5],[2; 2]);


plot(t,x(:,1),'-');
grid on

x0 = 2;
v0 = 2;
w0 = 11;
A = sqrt(x0^2+(v0^2/w0^2))

tg = w0*x0/v0;
tg

T = 2*pi/w0

f = 1 / T

2
Result:

A = 2.0082
tg = 11
T = 0.5712
f = 1.7507

b)
I.
h<w0

File Name: oclibera.m

function dxdt = oclibera(t,x)


h = 5;
w0 = 11;
dxdt = zeros(2,1);
dxdt(1)=x(2);
dxdt(2) = -2*h*x(2)-w0^2*x(1);

File Name: Main.m

[t,x] = ode15s(@oclibera,[0 5],[2; 2]);


plot(t,x(:,1),'-');
grid on

x0=2;
v0=2;
h=5;
w0=11;
w=sqrt(w0^2-h^2)

A=sqrt(x0^2+(v0+h*x0)^2/w^2)
3
tg=w*x0/(v0+h*x0)

T=2*pi/w

f=1/T

n=exp(-h*T)

Dec = h*T

Result:

w = 9.7980
A = 2.3452
tg = 1.6330
T = 0.6413
f = 1.5594
n = 0.040503
Dec = 3.2064

II.
h=w0

x0>0

x’0>0

File Name = oclibera.m

function dxdt = oclibera(t,x)


h=11;
w0=11;
dxdt = zeros(2,1);
dxdt(1) = x(2);
dxdt(2) = -2*h*x(2)-w0^2*x(1);
File Name = Main.m

[t,x] = ode15s(@oclibera,[0 30],[2; 10]);


plot(t,x(:,1),'-');

4
grid on

x0=2;
v0=10;
h=11;
w0=11;
w=sqrt(w0^2-h^2)
A=sqrt(x0^2+(v0+h*x0)^2/w^2)
tg=w*x0/(v0+h*x0)
T=2*pi/w
f=1/T
n=exp(-h*T)
Dec=h*T

Result:

w = 0
A = Inf
tg = 0
T = Inf
f = 0
n = 0
Dec = Inf

II’.
x0>0

x’0<0

|x’0|<h*x0

File Name = oclibera.m

function dxdt = oclibera(t,x)


h=5;
w0=5;
dxdt = zeros(2,1);
dxdt(1) = x(2);

5
dxdt(2) = -2*h*x(2)-w0^2*x(1);

File Name = Main.m

[t,x] = ode15s(@oclibera,[0 30],[2; -10]);


plot(t,x(:,1),'-');
grid on

Result:

II’’.
h=w0

x0>0

x’0<0

|x’0|>h*x0

File Name = oclibera.m

function dxdt = oclibera(t,x)


h=5;
w0=5;
dxdt = zeros(2,1);
dxdt(1) = x(2);
dxdt(2) = -2*h*x(2)-w0^2*x(1);

File Name = Main.m

[t,x] = ode15s(@oclibera,[0 50],[2; -30]);


plot(t,x(:,1),'-');
grid on

x0=2;
v0=10;
6
h=11;
w0=11;
w=sqrt(w0^2-h^2)
A=sqrt(x0^2+(v0+h*x0)^2/w^2)
tg=w*x0/(v0+h*x0)
T=2*pi/w
f=1/T
n=exp(-h*T)
Dec=h*T

Result:

w = 0
A = Inf
tg = 0
T = Inf
f = 0
n = 0
Dec = Inf
III.
h>w0

File name: oclibera.m

function dxdt = oclibera(t,x)


h=11;
w0=5;
dxdt = zeros(2,1);
dxdt(1) = x(2);
dxdt(2) = -2*h*x(2)-w0^2*x(1);

File Name = Main.m

[t,x] = ode15s(@oclibera,[0 4],[2; 2]);


plot(t,x(:,1),'-');
grid on

x0=2;
v0=2;
7
h=11;
w0=5
w=sqrt(w0^2-h^2)
A=sqrt(x0^2+(v0+h*x0)^2/w^2)
tg=w*x0/(v0+h*x0)
T=2*pi/w
f=1/T
n=exp(-h*T)
Dec=h*T
Result:

c)
I.
File name: ocfortat.m

function dxdt = ocfortat (t,x)


H=10;
W0=5;
P=2;
dxdt= zeros(2,1);
dxdt(1)=x(2);
dxdt(2)=-W0^2*x(1)+H*sin(P*t);

File name: main.m

[t,x]=ode45(@ocfortat,[0 4],[2; 2]);


plot(t,x(:,1),'-');
grid on
Result:

8
II.
File name: ocfortat2.m

function dxdt = ocfortat2 (t,x)


H=10;
W0=5.001;
P=2;
dxdt= zeros(2,1);
dxdt(1)=x(2);
dxdt(2)=-W0^2*x(1)+H*sin(P*t);

File name: main.m

[t,x]=ode45(@ocfortat2,[0 4],[2; 2]);


plot(t,x(:,1),'-');
grid on

H=10;
w0=5;
p=5.001;
A=H/abs(w0^2-p^2)

Result:

9
A = 999.90

III.
File name: ocfortat3.m

function dxdt = ocfortat3 (t,x)


H=10;
W0=5;
P=5;
dxdt= zeros(2,1);
dxdt(1)=x(2);
dxdt(2)=-W0^2*x(1)+H*sin(P*t);

File name: main.m

[t,x]=ode45(@ocfortat3,[0 4],[2; 2]);


plot(t,x(:,1),'-');
grid on

H=10;
w0=5;
p=5;
A=H/abs(w0^2-p^2)
Result:

A = Inf
d)
File name: ocfortat2.m

function dxdt = ocfortat2(t,x)


H=10;
w0=5;
p=5;

dxdt = zeros(2,1);
dxdt(1) = x(2);

10
dxdt(2) =-2.*x(2)-w0.^2.*x(1)+H.*sin(p.*t);

File name: main.m

[t,x]=ode45(@ocfortat2,[0:4],[1:2]);
plot(t,x(:,1),'-');
grid on

H=10;
w0=5;
p=5;
A=H/sqrt((w0^2-p^2)^2+4*H^2*p^2)
tg=2*H*p/(w0^2-p^2);
tg
Result:

A = 0.1000
tg = Inf

CONCLUZII:
We can calculate quad with octave.Single and multiple quads.Also; When we define variables, we will
calculate and get ecuatia diferentiala.

11

S-ar putea să vă placă și