Скачиваний:
11
Добавлен:
08.09.2024
Размер:
7 Кб
Скачать
clc
clear all
close all
%%
% Ваши исходные данные
x = [31.5, 63, 125, 250, 500, 1000, 2000, 4000, 8000]';
y = [82, 68.3, 51.5, 54, 50.6, 44.2, 38.4, 32.8, 31.9]';

% Создайте новую сетку точек для интерполяции
xx = linspace(min(x), max(x), 100);

% Используйте линейную интерполяцию для оценки значений на новой сетке
yy = interp1(x, y, xx, 'linear');

% Отображение результата
plot(x, y, 'o', xx, yy);
grid on
%%
x = [31.5,63,125,250,500,1000,2000,4000,8000]';
y1 = [96, 83, 74, 68, 63, 60, 57, 55, 54]';
y = [82, 68.3, 51.5, 54, 50.6, 44.2, 38.4, 32.8, 31.9]';
xx = 0:10:8000;% Интерполируем данные
smoothingFactor = 1; % Этот параметр регулирует степень сглаживания
%yy = csaps(x, y, smoothingFactor, xx);
yy = csaps(x, y, smoothingFactor, xx);%interp1(x, y, xx, 'linear');
yy1 = interp1(x, y1, xx, 'linear');


% Ограничение интерполированных значений
%yy(yy > 1) = 1;
%yy(yy < 0) = 0;

plot(xx, yy, "-", LineWidth=1, Color='blue')
hold on
plot(xx, yy1, "--", LineWidth=1, Color='red')
%set(gca, 'YLim', [-0.0 1.1])
grid on
xlabel("f, Гц")
ylabel("Уровень звукового давления, дБ")
legend("Шумовой фон","ПДУ", fontsize = 16)
%%
x = [31.5,63,125,250,500,1000,2000,4000,8000]';
y1 = [96, 83, 74, 68, 63, 60, 57, 55, 54]';
y = [64.8,71.5,	59.6,	81.8,	90.5,	101.9,	104.9,	92.1,	69.9]';
xx = 0:10:8000;% Интерполируем данные
smoothingFactor = 1; % Этот параметр регулирует степень сглаживания
%yy = csaps(x, y, smoothingFactor, xx);
yy = csaps(x, y, smoothingFactor, xx);%interp1(x, y, xx, 'linear');
yy1 = interp1(x, y1, xx, 'linear');


% Ограничение интерполированных значений
%yy(yy > 1) = 1;
%yy(yy < 0) = 0;

plot(xx, yy, "-", LineWidth=1, Color='blue')
hold on
plot(xx, yy1, "--", LineWidth=1, Color='red')
%set(gca, 'YLim', [-0.0 1.1])
grid on
xlabel("f, Гц")
ylabel("Уровень звукового давления, дБ")
legend("Источник шума","ПДУ", fontsize = 16)
%%
yk1 = [54.9	,65.7,	51.6,	67.8,	80.9,	95.9,	93.5,	50.4,	55.1];
yk2 = [61.1	,62.3,	58.4,	70.3,	80.6,	90.2,	86.8,	66.9,	43.8];

yyk1 = interp1(x, yk1, xx, 'linear');
yyk2 = interp1(x, yk2, xx, 'linear');

plot(xx, yyk1, "--", LineWidth=2, Color='green')
plot(xx, yyk2, LineWidth=2, Color='blue')

legend("Без защиты","ПДУ", "Кожух №1", "Кожух №2", fontsize = 16)
%%
y1e = [9.9,5.8,	8	,14,	9.6,	6	,11.4,	41.7,	14.8];
y2e = [3.7,	9.2,	1.2,	11.5,	9.9,	11.7,	18.1,	25.2,	26.1];

yy1e = csaps(x, y1e, smoothingFactor, xx)%interp1(x, y1e, xx, 'linear');
yy2e = csaps(x, y2e, smoothingFactor, xx)%interp1(x, y2e, xx, 'linear');

plot(xx, yy1e, "--", LineWidth=2, Color='green')
hold on
grid on
plot(xx, yy2e, LineWidth=2, Color='blue')
legend("Кожух №1", "Кожух №2", fontsize = 16)
%%
ye1 = [54.3,59.1,	56.6,	78.5,	84.5,	87.5,	93.8,	82.4,	56.4];
ye2 = [61,	59.7,	68,	80.6,	85.8,	96.7,	103.6,	87.3,	63.3];
ye3 = [52.1,	58.1,	58.9,	79.2,	85.2,	97.5,	94.2,	83.1,	56.9];
ye4 = [53.6	,60.6,	63.3,	79.8,	84.7,	97.6,	95.1,	85.1,	57.8];
y1 = [96, 83, 74, 68, 63, 60, 57, 55, 54]';

yye1 = interp1(x, ye1, xx, 'linear');
yye2 = interp1(x, ye2, xx, 'linear');
yye3 = interp1(x, ye3, xx, 'linear');
yye4 = interp1(x, ye4, xx, 'linear');

plot(xx, yye1, "--", LineWidth=2, Color='red');
hold on
plot(xx, yye2, "-.", LineWidth=2, Color='black');
hold on
plot(xx, yye3, LineWidth=1, Color='green');
hold on
plot(xx, yye4, "-", LineWidth=1, Color='blue');
grid on
plot(xx, yy1);
legend("Экран №1", "Экран №2", "Экран №3", "Экран №4", "ПДУ", fontsize = 16)
%%
yee1 = [10.5	,12.4,	3,	3.3,	6,	14.4,	11.1,	9.7,	13.5];
yee2 = [3.8	,11.8,	-8.4,	1.2,	4.7,	5.2,	1.3,	4.8,	6.6];
yee3 = [12.7,	13.4,	0.7,	2.6,	5.3,	4.4,	10.7,	9,	13];
yee4 = [11.2,	10.9,	-3.7,	2,	5.8,	4.3,	9.8,	7,	12.1];

yyee1 = csaps(x, yee1, smoothingFactor, xx)%interp1(x, yee1, xx, 'linear');
yyee2 = csaps(x, yee2, smoothingFactor, xx)%interp1(x, yee2, xx, 'linear');
yyee3 = csaps(x, yee3, smoothingFactor, xx)%interp1(x, yee3, xx, 'linear');
yyee4 = csaps(x, yee4, smoothingFactor, xx)%interp1(x, yee4, xx, 'linear');

plot(xx, yyee1, "--", LineWidth=2, Color='red');
hold on
plot(xx, yyee2, "-.", LineWidth=2, Color='black');
hold on
plot(xx, yyee3, LineWidth=1, Color='green');
hold on
plot(xx, yyee4, "-", LineWidth=1, Color='blue');
grid on
legend("Эффективность экрана №1", "Эффективность экрана №2", "Эффективность экрана №3", "Эффективность экрана №4", fontsize = 16)
%%



%%
ye1 = [58.7,	61.7,	58.8,	66.8,	74.4,	91.8,	92.2,	78,	49.8];
ye2 = [55,	61.6,	63,	68.3,	74.5,	83.5,	84,	64.9,	35.3];
ye3 = [59.3,	62.9,	59.2,	66.1,	72.9,	83.4,	82.1,	62.2,	35.1];
ye4 = [58,	61.1	,62.2,	66.4,	73.8,	83.8,	82.4,	63.2,	34.3];
y1 = [96, 83, 74, 68, 63, 60, 57, 55, 54]';

yye1 = interp1(x, ye1, xx, 'linear');
yye2 = interp1(x, ye2, xx, 'linear');
yye3 = interp1(x, ye3, xx, 'linear');
yye4 = interp1(x, ye4, xx, 'linear');

plot(xx, yye1, "--", LineWidth=2, Color='red');
hold on
plot(xx, yye2, "-.", LineWidth=2, Color='black');
hold on
plot(xx, yye3, LineWidth=1, Color='green');
hold on
plot(xx, yye4, "-", LineWidth=1, Color='blue');
grid on
plot(xx, yy1);
legend("Экран №1 + Кожух №2", "Экран №2 + Кожух №2", "Экран №3 + Кожух №2", "Экран №4 + Кожух №2", "ПДУ", fontsize = 16)
%%
yee1 = [6.1,	9.8,	0.8,	15,	16.1,	10.1,	12.7	,14.1,	20.1];
yee2 = [9.8,	9.9,	-3.4,	13.5,	16	,18.4,	20.9,	27.2,	34.6];
yee3 = [5.5,	8.6,	0.4,	15.7,	17.6,	18.5,	22.8,	29.9,	34.8];
yee4 = [6.8,	10.4,	-2.6,	15.4,	16.7,	18.1,	22.5	,28.9,	35.6];

yyee1 = csaps(x, yee1, smoothingFactor, xx)%
yyee2 = csaps(x, yee2, smoothingFactor, xx)
yyee3 = csaps(x, yee3, smoothingFactor, xx)%
yyee4 = csaps(x, yee4, smoothingFactor, xx)%

plot(xx, yyee1, "--", LineWidth=2, Color='red');
hold on
plot(xx, yyee2, "-.", LineWidth=2, Color='black');
hold on
plot(xx, yyee3, LineWidth=1, Color='green');
hold on
plot(xx, yyee4, "-", LineWidth=1, Color='blue');
grid on
legend("Эффективность экрана №1 + Кожух №2", "Эффективность экрана №2 + Кожух №2", "Эффективность экрана №3 + Кожух №2", "Эффективность экрана №4 + Кожух №2", fontsize = 16)
%%









%%
ym = [50.1, 68.3, 69.7, 67.4, 74.6, 84.3, 84.3, 65.7, 35.9];
em = [4.6, 0.8, -9.4, 13.9, 16, 17.1, 20.8, 25.8, 32.6];
yym = interp1(x, ym, xx, 'linear');
eem = interp1(x, em, xx, 'linear');

plot(xx, yym, LineWidth=2, Color='blue');
hold on 
plot(xx, yy);
legend("Кожух №2 + Экран №3", "ПДУ", fontsize = 16)
grid on
%%
plot(xx, eem, LineWidth=2, Color='black');
hold on 
plot(xx, yy2e, "-.", LineWidth=2, Color='blue')
grid on
legend("Эффективность Кожух №2 + Экран №3", "Эффективность кожуха №2" ,fontsize = 16)
Соседние файлы в папке Лаб7