Borrar filtros
Borrar filtros

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 visualización (últimos 30 días)
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));

Respuestas (2)

Cris LaPierre
Cris LaPierre el 19 de Dic. de 2022
Editada: Cris LaPierre el 19 de Dic. de 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 el 19 de Dic. de 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 comentarios
Image Analyst
Image Analyst el 19 de Dic. de 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));

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by