I have the following code in Matlab, the problem is that it does not graph anything, nothing comes out of plot *does not show any error in the console

2 次查看(过去 30 天)
fc1=0.33;
fc2=0.83;
f=[fc1,fc2];
h=fir1(64,f,'stop');
[samplerate.data]=audioread("Domini_Fil.wav");
plot(data)
filteredData=filtfilt(h,1,data);
plot(filteredData);
[w,rh]=freq(h,1,64);
w_pi=(w/pi)*6;
plot(w_pi,abs(rh));
fft_input=fft(data);
fft_output=fft(filteredData);
plot(abs(fft_input));
plot(abs(fft_output));

回答(2 个)

Cris LaPierre
Cris LaPierre 2022-12-19
编辑:Cris LaPierre 2022-12-19
Attach your wav file to your question using the paperclip icon. It would also help to have your freq function code. Still, using a built-in wav file (bluewhale.wav), there doesn't appear to be anything wrong with your code. Perhaps your file does not have any data?
fc1=0.33;
fc2=0.83;
f=[fc1,fc2];
h=fir1(64,f,'stop');
[data]=audioread("bluewhale.wav");
plot(data)
filteredData=filtfilt(h,1,data);
plot(filteredData);
% [w,rh]=freq(h,1,64);
% w_pi=(w/pi)*6;
% plot(w_pi,abs(rh));
fft_input=fft(data);
fft_output=fft(filteredData);
plot(abs(fft_input));
plot(abs(fft_output));

Image Analyst
Image Analyst 2022-12-19
Try calling
hold on
after your first call to plot.
If you have any more questions, then attach your data ("Domini_Fil.wav") with the paperclip icon after you read this:
  2 个评论
Image Analyst
Image Analyst 2022-12-19
After the first call to plot, if you want them all on the same graph. Or use subplot if you want them in separate graphs.
fc1=0.33;
fc2=0.83;
f=[fc1,fc2];
h=fir1(64,f,'stop');
[samplerate.data]=audioread("Domini_Fil.wav");
plot(data)
hold on; % Prevent subsequent plots from blowing away earlier ones.
filteredData=filtfilt(h,1,data);
plot(filteredData);
[w,rh]=freq(h,1,64);
w_pi=(w/pi)*6;
plot(w_pi,abs(rh));
fft_input=fft(data);
fft_output=fft(filteredData);
plot(abs(fft_input));
plot(abs(fft_output));

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by