Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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));

Antworten (2)

Cris LaPierre
Cris LaPierre am 19 Dez. 2022
Bearbeitet: Cris LaPierre am 19 Dez. 2022
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 am 19 Dez. 2022
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 Kommentare
Image Analyst
Image Analyst am 19 Dez. 2022
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));

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by