プログラムのエラー表示

3 次查看(过去 30 天)
Kaede
Kaede 2020-8-19
回答: michio 2020-8-21
ホワイトノイズにバンドパスフィルタをかけたものは上手く表示できたのにピングノイズにバンドパスフィルタをかけるとこのようなエラー表示がでます.データ数Nはp1に合わせて448512にしてあります.
要求された 448512x448505 (1498.8GB) 配列は、最大配列サイズの設定を超え
ています。この制限より大きい配列を作成すると、処理に時間がかかり、MATLAB
が反応しなくなることがあります。詳細については、配列サイズの制限または設定パ
ネルを参照してください。
エラー: pinknoiseknock (line 18)
smix_Lch=6*Lch_p1+Lch_p2/10+y/10;
[p1,fs]=audioread('40kph_RN.wav');
[p2,fs]=audioread('2000rpm_Knock.wav');
fs=44100;
L=8;N=448505;
%x=[zeros(L-1,1);randn(N,1)];
g=randp(N);
y=filter(Num,1,g)
p2(448512,[1 2]) = [0,0];
Lch_p1=p1(:,1);
Rch_p1=p1(:,2);
Lch_p2=p2(:,1);
Rch_p2=p2(:,2);
smix_Lch=6*Lch_p1+Lch_p2/10+y/10;
%soundsc(smix_Lch,fs)
filename='mix_Lch.wav';
audiowrite(filename,smix_Lch,fs);
smix_Rch=6*Rch_p1+Rch_p2/10+y/10;
%soundsc(smix_Rch,fs)
filename='mix_Rch.wav';
audiowrite(filename,smix_Rch,fs);
%y=filter(Num,1,g)
fft_white=fft(y/10);
dB_white=mag2db(abs(fft_white));
fft_p1L=fft(6*Lch_p1);
dB_p1L=mag2db(abs(fft_p1L));
fft_p1R=fft(6*Rch_p1);
dB_p1R=mag2db(abs(fft_p1R));
fft_p2L=fft(Lch_p2/10);
dB_p2L=mag2db(abs(fft_p2L));
fft_p2R=fft(Rch_p2/10);
dB_p2R=mag2db(abs(fft_p2R));
f = (0:length(fft_p1L)-1)*fs/length(fft_p1L);
figure(1)
semilogx(f,dB_p2L)
xlim([0 fs/2])
ylim([-100,100])
xlabel('frequency[Hz]')
ylabel('Magnitude[dB]')
hold on
semilogx(f,dB_p1L)
grid on, hold off
hold on
semilogx(f,dB_white)
grid on, hold off
legend('2000rpm.knock','roadnoise','whitenoise');
figure(2)
semilogx(f,dB_p2R)
xlim([0 fs/2])
ylim([-100,100])
xlabel('frequency[Hz]')
ylabel('Magnitude[dB]')
hold on
semilogx(f,dB_p1R)
grid on, hold off
hold on
semilogx(f,dB_white)
grid on, hold off
legend('2000rpm.knock','roadnoise','whitenoise');

采纳的回答

michio
michio 2020-8-21
smix_Lch=6*Lch_p1+Lch_p2/10+y/10;
の計算において、448512x1 のベクトルと 1x448505 のベクトルの足し算が発生しているのかと想像しています。
各変数の配列サイズを確認してみてください。
簡単な例ですと、10x1 と 1x10 のベクトルを足し合わせると 10x10 の配列が作られます。
x = rand(10,1);
y = rand(1,10);
z = x+y;
whos z
Name Size Bytes Class Attributes
z 10x10 800 double

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 フーリエ解析とフィルター処理 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!