Добавил:
ivanov666
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Моделирование инженерных систем и технологических процессов. Учебное пособие.pdf
X
- •ОГЛАВЛЕНИЕ
- •ВВЕДЕНИЕ В MATLAB
- •ПОСТРОЕНИЕ ГРАФИКОВ
- •СИМВОЛЬНЫЕ ВЫЧИСЛЕНИЯ
- •СИСТЕМНЫЙ АНАЛИЗ В MATLAB
- •ПРАКТИЧЕСКАЯ РАБОТА № 1
- •ПРАКТИЧЕСКАЯ РАБОТА № 2
- •ПРАКТИЧЕСКАЯ РАБОТА № 3
- •ПРАКТИЧЕСКАЯ РАБОТА № 4
- •ПРАКТИЧЕСКАЯ РАБОТА № 5
- •ПРАКТИЧЕСКАЯ РАБОТА № 6
- •ПРАКТИЧЕСКАЯ РАБОТА № 7
- •ПРАКТИЧЕСКАЯ РАБОТА № 8
- •ПРАКТИЧЕСКАЯ РАБОТА № 9
- •ПРАКТИЧЕСКАЯ РАБОТА № 10
- •ПРАКТИЧЕСКАЯ РАБОТА № 11
- •ПРАКТИЧЕСКАЯ РАБОТА № 12

-15
-10
-5
0
5
10
15
0
5
10
n
v(n)
-15
-10
-5
0
5
10
15
0
5
10
n
w(n)
-15
-10
-5
0
5
10
15
0
5
10
n
q(n)
Рис. 19.4. Результаты работы программы
41

ПРАКТИЧЕСКАЯ РАБОТА № 7
1
21
1 11 2
21
2
0, 0
0, 0
4, 0
4, 0 3
()
74
( ),
4 ( 3), 3 6
63
0, 6
0,
t
t
tt
t
xt
xx
x tt t t t
tt
tt
t
tt
<
<
≤<
≤<
==
−
−
+ − ≤<
+ − ≤<
−
−
≥
≥
Задан непрерывный сигнал:
Рис. 20. Изображение сигнала
a) Представить сигнал x(t), используя линейную комбинацию
сигналов Хевисайда переведенных во времени и построить его.
b) Найти сигналы m(t) = x(3t), n(t) = x(–3t), o(t) = x(3 + 3t),
p(t) = x(3 – 3t) и построить их на одном графике, используя subplot.
Решение:
x(t) = 4(h(t − 0) − h(t −3)) + (t +1)(h(t −3) − h(t − 6)).
Листинг программы:
clear all;close all;clc;
%a
t=-5:0.01:10;
h_ot_0_do_3 = (t>=0) - (t>=3);
h_ot_3_do_6 = (t>=3) - (t>=6);
x = 4*h_ot_0_do_3 + (t+1).*h_ot_3_do_6;
figure(1);
plot(t,x); xlabel('t(s)'); ylabel('x(t)');
%b
m = 4*(( 3*t>=0)-( 3*t>=3)) + ( 3*t+1).*(( 3*t>=3)-( 3*t>=6));
n = 4*((-3*t>=0)-(-3*t>=3)) + (-3*t+1).*((-3*t>=3)-(-3*t>=6));
o = 4*(((3+3*t)>=0)-((3+3*t)>=3)) + ((3+3*t)+1).*(((3+3*t)>=3)-
((3+3*t)>=6));
42

p = 4*(((3-3*t)>=0)-((3-3*t)>=3)) + ((3-3*t)+1).*(((3-3*t)>=3)-((3-
-5
0
5
10
0
1
2
3
4
5
6
7
t(s)
x(t)
-5 0 5 10
0
5
10
t(s)
x(t)
-5 0 5 10
0
5
10
t(s)
m(t)
-5 0 5 10
0
5
10
t(s)
n(t)
-5 0 5 10
0
5
10
t(s)
o(t)
-5 0 5 10
0
5
10
t(s)
p(t)
3*t)>=6));
figure(2);
subplot(5,1,1); plot(t,x); xlabel('t(s)'); ylabel('x(t)');
subplot(5,1,2); plot(t,m); xlabel('t(s)'); ylabel('m(t)');
subplot(5,1,3); plot(t,n); xlabel('t(s)'); ylabel('n(t)');
subplot(5,1,4); plot(t,o); xlabel('t(s)'); ylabel('o(t)');
subplot(5,1,5); plot(t,p); xlabel('t(s)'); ylabel('p(t)');
Рис. 21.1. Результаты работы программы
Рис. 21.2. Результаты работы программы
43

ПРАКТИЧЕСКАЯ РАБОТА № 8
0
6
0
0, 0
( ) { ( ), ( )} ( ) ( ) ( 2) 4(0,75) , [0,6]
( 2) 4(0, 75) , 7
n
nk
kk
nk
k
n
cv n Conv x n y n x k y n k k n
kn
∞
−
=−∞ =
−
=
<
= = − = +⋅ ∈
+⋅ ≥
∑∑
∑
6
0
6
( 2) 4(0,75) , 0
( ) { ( ), ( )} ( ) ( ) ( 2) 4(0,75) , 7 0
0, 7
nk
k
nk
k kn
kn
cr n Corr x n y n x k y n k k n
n
+
=
∞
+
=−∞ =−
+⋅ >
= = + = + ⋅ −< ≤
≤−
∑
∑∑
Заданы два дискретных сигнала
x(n) = (n + 2)(h(n) – h(n – 7)), y(n) = 4(0,75)
a) Определить cv = Conv{x, y} и нарисовать x, y и cv
b) Определить cr = Corr{x, y} и нарисовать x, y и cr
Решение:
Листинг программы:
clear all;close all;clc;
k=-15:15;
h_ot_0_do_7 = (k>=0) - (k>=7);
x = (k+2).*h_ot_0_do_7;
h = (k>=0);
y = 4*0.75.^k.*h;
figure(1);
subplot(2,1,1); stem(k,x); xlabel('k'); ylabel('x(k)');
subplot(2,1,2); stem(k,y); xlabel('k'); ylabel('y(k)');
%a
n=-5; h_n_minus_k = (n-k>=0); %n is a random number from a re-
quired range
44
n
h(n)

y_n_minus5 = 4*0.75.^(n-k).*h_n_minus_k;
n=3; h_n_minus_k = (n-k>=0);
y_n_3 = 4*0.75.^(n-k).*h_n_minus_k;
n=10; h_n_minus_k = (n-k>=0);
y_n_10 = 4*0.75.^(n-k).*h_n_minus_k;
figure(2);
subplot(4,1,1); stem(k,x); xlabel('k'); ylabel('x(k)');
subplot(4,1,2); stem(k,y_n_minus5); xlabel('k'); ylabel('y(n-k), n<0');
subplot(4,1,3); stem(k,y_n_3); xlabel('k'); ylabel('y(n-k), 0<=n<7');
subplot(4,1,4); stem(k,y_n_10); xlabe l ( 'k'); ylabel('y(n-k), n>7');
syms n k;
cv1=symsum((k+2) * 4*(3/4)^(n-k),k,0,n);
cv1=simple(cv1);
cv2=symsum((k+2) * 4*(3/4)^(n-k),k,0,6);
cv2=simple(cv2);
n=-15:15;
h_ot_7_do_besk = (n>=7);
cv = subs(cv1,n).*h_ot_0_do_7 + subs(cv2,n).*h_ot_7_do_besk;
figure(3);
subplot(3,1,1); stem(n,x); xlabel('n'); ylabel('x(n)');
subplot(3,1,2); stem(n,y); xlabel('n'); ylabel('y(n)');
subplot(3,1,3); stem(n,cv); xlabel('n'); ylabel('cv(n)');
%b
k=-15:15;
n=5; h_n_plus_k = (n+k>=0);
y_n_5 = 4*0.75.^(n+k).*h_n_plus_k;
n=-3; h_n_plus_k = (n+k>=0);
y_n_minus3 = 4*0.75.^(n+k).*h_n_plus_k;
n=-9; h_n_plus_k = (n+k>=0);
y_n_minus9 = 4*0.75.^(n+k).*h_n_plus_k;
figure(4);
subplot(4,1,1); stem(k,x); xlabel('k'); ylabel('x(k)');
subplot(4,1,2); stem(k,y_n_5); xlabel('k'); ylabel('y(n+k), n>0');
subplot(4,1,3); stem(k,y_n_minus3); xlabel('k'); ylabel('y(n+k), -
7<n<=0');
45

subplot(4,1,4); stem(k,y_n_minus9); xlabel('k'); ylabel('y(n+k), n<=-
-15 -10 -5 0
5 10 15
0
5
10
n
x(n)
-15 -10 -5
0
5
10 15
0
2
4
n
y(n)
-15 -10 -5 0 5 10 15
0
50
100
n
cv(n)
7');
syms n k
cr1=symsum((k+2)*4*(3/4)^(n+k),k,0,6);
cr1=simple(cr1)
cr2=symsum((k+2)*4*(3/4)^(n+k),k,-n,6);
cr2=simple(cr2)
n=-15:15;
h_ot_minus6_do_1 = (n>=-6)-(n>=1);
h_ot_1_do_besk = (n>=1);
cr = subs(cr2,n).*h_ot_minus6_do_1 + subs(cr1,n).*h_ot_1_do_besk;
figure(5);
subplot(3,1,1); stem(n,x); xlabel('n'); ylabel('x(n)');
subplot(3,1,2); stem(n,y); xlabel('n'); ylabel('y(n)');
subplot(3,1,3); stem(n,cr); xlabel('n'); ylabel('cr(n)');
Рис. 22.1. Результаты работы программы
46

-15
-10 -5 0 5 10 15
0
5
10
n
x(n)
-15 -10 -5 0 5 10
15
0
2
4
n
y(n)
-15
-10 -5 0 5 10 15
0
50
100
n
cr(n)
Рис. 22.2. Результаты работы программы
47

ПРАКТИЧЕСКАЯ РАБОТА № 9
0,3( )
2
6
0,3( )
2
0, 0
() { (), ()} ( ) ( ) 4 ( 2) ,2 6
4 ( 2) , 6
t
t
t
t
t
cv t Conv y t x t x t y d e d t
e dt
∞
− −τ
=−∞ τ=
− −τ
τ=
<
= = −τ τ τ= τ+ τ ≤ ≤
τ+ τ >
∫∫
∫
Заданы два непрерывных сигнала:
x(t) = 4e
–0.3t
h(t), y(t) = (t + 2)(h(t – 2) – h(t – 6))
c) Определить cv = Conv{x, y} и нарисовать x, y и cv
d) Определить cr = Corr{x, y} и нарисовать x, y и cr
Решение:
Листинг программы:
clear all;close all; clc;
t=-20:0.01:20;
h = (t>=0);
x = 4*exp(-0.3*t).*h;
h_ot_2_do_6 = (t>=2) - (t>=6);
y = (t+2).*h_ot_2_do_6;
figure(1);
subplot(2,1,1); plot(t,x); xlabel('t'); ylabel('x(t)');
subplot(2,1,2); plot(t,y); xlabel('t'); ylabel('y(t)');
tau = -20:0.01:20;
h_od_2_do_6 = (tau>=2) - (tau>=6);
y = (tau+2).*h_od_2_do_6;
t=-5; h_t_minus_tau = (t-tau>=0);
x_t_minus_tau_V1 = 4*exp(-0.3*(t-tau)).*h_t_minus_tau;
t=4; h_t_minus_tau = (t-tau>=0);
x_t_minus_tau_V2 = 4*exp(-0.3*(t-tau)).*h_t_minus_tau;
t=12; h_t_minus_tau = (t-tau>=0);
x_t_minus_tau_V3 = 4*exp(-0.3*(t-tau)).*h_t_minus_tau;
figure(2);
subplot(4,1,1); plot(tau,y); xlabel('\tau'); ylabel('y(\tau)');
48

subplot(4,1,2); plot(tau,x_t_minus_tau_V1);
xlabel('\tau'); ylabel('x(t-\tau), t<2');
subplot(4,1,3); plot(tau,x_t_minus_tau_V2);
xlabel('\tau'); ylabel('x(t-\tau), 2<=t<=6');
subplot(4,1,4); plot(tau,x_t_minus_tau_V3);
xlabel('\tau'); ylabel('x(t-\tau), t>6');
syms t tau
cv1=int(4*exp(-0.3*(t-tau))*(tau+2),tau,2,t)
cv1=simple(cv1);
cv2=int(4*exp(-0.3*(t-tau))*(tau+2),tau,2,6)
cv2=simple(cv2);
t=-20:0.01:20;
h_ot_2_do_6 = (t>=2) - (t>=6);
h_ot_6_do_besk = (t>=6);
cv = subs(cv1,t).*h_ot_2_do_6 + subs(cv2,t).*h_ot_6_do_besk;
figure(3);
subplot(3,1,1); plot(t,x); xlabel('t'); ylabel('x(t)');
subplot(3,1,2); plot(t,y); xlabel('t'); ylabel('y(t)');
subplot(3,1,3); plot(t,cv); xlabel('t'); ylabel('cv(t)');
%b
tau=-20:0.01:20;
t=12; h_t_plus_tau = (t+tau>=0);
x_t_plus_tau_V1 = 4*exp(-0.3*(t+tau)).*h_t_plus_tau;
t=-4; h_t_plus_tau = (t+tau>=0);
x_t_plus_tau_V2 = 4*exp(-0.3*(t+tau)).*h_t_plus_tau;
t=-10; h_t_plus_tau = (t+tau>=0);
x_t_plus_tau_V3 = 4*exp(-0.3*(t+tau)).*h_t_plus_tau;
figure(4);
subplot(4,1,1); plot(tau,y); xlabel('\tau'); ylabel('y(\tau)');
subplot(4,1,2); plot(tau,x_t_plus_tau_V1);
xlabel('\tau'); ylabel('x(t+\tau), t<-2');
subplot(4,1,3); plot(tau,x_t_plus_tau_V2);
xlabel('\tau'); ylabel('x(t+\tau), -2>=t>=-6');
subplot(4,1,4); plot(tau,x_t_plus_tau_V3);
xlabel('\tau'); ylabel('x(t+\tau), t>6');
syms t tau
49

cr1=int(4*exp(-0.3*(t+tau))*(tau+2),tau,2,6)
-20 -15 -10 -5 0 5
10 15 20
0
2
4
t
x(t)
-20
-15 -10 -5 0 5 10 15 20
0
5
10
t
y(t)
-20 -15 -10 -5 0 5 10 15 20
0
50
100
t
cv(t)
cr1=simple(cr1);
cr2=int(4*exp(-0.3*(t+tau))*(tau+2),tau,-t,6)
cr2=simple(cr2);
t=-20:0.01:20;
h_ot_minus6_do_minus1 = (t>=-6) - (t>=-1);
h_ot_2_do_besk = (t>=-1);
cr = subs(cr2,t).*h_ot_minus6_do_minus1 +
subs(cr1,t).*h_ot_2_do_besk;
figure(5);
subplot(3,1,1); plot(t,x); xlabel('t'); ylabel('x(t)');
subplot(3,1,2); plot(t,y); xlabel('t'); ylabel('y(t)');
subplot(3,1,3); plot(t,cr); xlabel('t'); ylabel('cv(t)');
Рис. 23.1. Результаты работы программы
50
Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]
