Documente Academic
Documente Profesional
Documente Cultură
LL1 PS Mereuță Ana
LL1 PS Mereuță Ana
RAPORT
Lucrare de laborator Nr.1
Disciplina: Prelucrarea Semnalelor
Tema: Introducere în MatLab
A verificat : asist.univ.
Dubac Serghei
Chișinău 2021
Scopul lucrării:
Listing-ul:
a = randn(1,5)
for i=1:1:5
if a(1,i) < 0
a (1,i)
end
end
Fig. 2 Rezultatul execuției
Listing-ul funcției:
function [ ] = complex_rez (complex_m)
%ex 3 a
r =real(complex_m);
im = imag(complex_m);
m=mean(r)
%ex 3 b
r_b= r.^2
im_b= im.^2
%ex 3 c
complexmatrix1= diag(diag(complex_m));
end
n=0:20;
t=abs(10-n);
figure(2)
stem(n,t)
n1=-15:25;
x1=sin(pi/17*n1);
n2=0:50;
x2=cos(pi/sqrt(23)*n2);
figure(3)
plot(n1,x1,'b',n2,x2,'r')
figure(4)
subplot(2,1,1)
plot(n1,x1)
subplot(2,1,2)
plot(n2,x2)
figure(5)
stem(n1,x1)
hold on
stem(n2,x2)
hold off
figure(6)
subplot(2,1,1)
stem(n1,x1)
subplot(2,1,2)
stem(n2,x2)
Fig. 5 Reprezentarea grafică a vectorului utilizând comanda subplot
Fig. 11
F=50;
t=0:0.01: 0.2;
s=2*sin(2*pi*F*t);
plot(t, s, '.-'), xlabel('Timp, s'), grid
Fig. 12
F=50;
t=0:0.0002: 0.2;
s=2*sin(2*pi*F*t);
plot(t, s, '.-'), xlabel('Timp, s'), grid
Fig. 13
F=50;
F2=20;
t=0:0.0002: 0.2;
s=2*sin(2*pi*F*t);
c=2*cos(2*pi*F*t);
plot(t, s, '.-'), xlabel('Timp, s'), grid
hold on
plot(t, c, '.-'), xlabel('Timp, s'), grid
Fig. 14
figure(2);
plot(x,y);
figure(3);
stem(x,y);
hold on;
plot(x,y,'r');
figure(4);
stem(x,y);
hold on;
plot(x,y);
axis([-10 100 -5 200])
Fig. 15
Fig. 16
Fig. 17
Fig. 18
j ∙ x 2j 2
f ( x j )= − , x =−1.1+0.1∙ j, j=1,2, … , 11.
x j−1 j +1 j
π /2
Listing-ul programului (1 a)
x= [-2, -1.5, 0, 0.5, 2.5, 3];
y= [6, 9, 11, 10, 7, 5];
df=diff(y)./diff(x);
vx1= [-2, 0, 2.5];
for i=1:1:length(vx1)
k=find(x==vx1(i));
disp(['f''(' num2str(vx1(i)) ')=' num2str(df(k))])
end
df=diff(y)./diff(x);
vx1= [-1.5, 0, 3];
for i=1:1:length(vx1)
k=find(x==vx1(i));
disp(['f''(' num2str(vx1(i)) ')=' num2str(df(k-1))])
end
dx=diff(x);
dy=diff(y);
k=length(dx);
df=(dy(1:k-1)+dy(2:k))./(dx(1:k-1) +dx(2:k));
vx1= [-0.75, 0.25, 0.5, 1];
for i=1:1:length(vx1)
k=find(x==vx1(i));
disp(['f''(' num2str(vx1(i)) ')=' num2str(df(k))])
end
dfa=diff(y)./diff(x);
vxa1= [-2, 0, 2.5];
for i=1:1:length(vxa1)
k=find(x==vxa1(i));
disp(['f''(' num2str(vxa1(i)) ')=' num2str(dfa(k))])
end
dfb=diff(y)./diff(x);
vxb1= [-1.5, 0, 3];
for i=1:1:length(vxb1)
k=find(x==vxb1(i));
disp(['f''(' num2str(vxb1(i)) ')=' num2str(dfb(k-1))])
end
dxc=diff(x);
dyc=diff(y);
k=length(dxc);
dfc=(dyc(1:k-1)+dyc(2:k))./(dxc(1:k-1) +dxc(2:k));
vxc1= [-0.75, 0.25, 0.5, 1];
for i=1:1:length(vxc1)
k=find(x==vxc1(i));
disp(['f''(' num2str(vxc1(i)) ')=' num2str(dfc(k))])
end
subplot(2,2,1)
plot(dfa), xlabel('diferente progresive')
subplot(2,2,2)
plot(dfb), xlabel ('diferente regresive')
subplot(2,2,3)
plot(dfc) , xlabel('diferente centrate')
Fig. 22 Reprezentarea grafica
Listing-ul programului (2 a)
coeficienti= [1, 13, -7, 1, -1];
dcoef= polyder(coeficienti);
vx= [-2, -1.3, 0.1, 2.45];
derivat=polyval(dcoef, vx)
x=-2:0.2:3;
df=polyval(dcoef, x);
plot(x, df)
Fig.23
Fig. 24
Listing-ul programului:
x=1:11;
y=1:11;
for j=1:11
x(j) = (-1.1 + 0.1*j);
y(j) = (((j * x(j)^2)/((x(j)-1))) - (2 / (j+1)));
end
Integ1= trapz(x,y);
disp([num2str(Integ1)]);
Fig. 25
function y=f(x)
y=1./(sin(x)+cos(x));
Fig. 26