when ever i use butter and filter function to plot,nothing is shown in my output screen.Except butter code output all other outputs are shown

12 comentarios

Mathieu NOE
Mathieu NOE el 23 de Jul. de 2021
hi
it would be more efficient it you woud share your code & data ...
tx
Scott MacKenzie
Scott MacKenzie el 23 de Jul. de 2021
Editada: Scott MacKenzie el 24 de Jul. de 2021
No output using butter? Try the code below. Do you get any output on your screen?
fc = 300;
fs = 1000;
[b,a] = butter(6,fc/(fs/2));
freqz(b,a)
But, really, how do you expect a helpful answer given the absence of detail in your question. As @Mathieu NOE notes, post your code and data.
MICHKEL ANGLO J
MICHKEL ANGLO J el 24 de Jul. de 2021
@Scott MacKenzie i used that code also no output for me.
here is my code:
clc;
clear all;
close all;
m=1;
Am=5;
Fa=2000
ta=1/Fa;
t=0:ta/999:6*ta;
ym=Am*sin(2*pi*Fa*t);
subplot(4,1,1);
plot(t,ym);
title('message signal')
SNR=1
Ac=5
Fc=Fa*10;
tc=1/Fc
yc=Ac*sin(2*pi*Fc*t);
subplot(4,1,2);
plot(t,yc);
grid on;
title('carrier signal')
y=Ac.*(1+m*sin(2*pi*Fa*t)).*sin(2*pi*Fc*t);
subplot(4,1,3);
plot(t,y)
grid on;
title('Amplitude modulation');
s1=y.*yc;
[b,a]=butter(4,0.004);
s2=filter(b,a,s1);
subplot(4,1,4);
plot(s2);
grid on;
title('am demod');
below my code execution.i don'y get by 4th graph
MICHKEL ANGLO J
MICHKEL ANGLO J el 24 de Jul. de 2021
@Mathieu NOE i posted the code
Scott MacKenzie
Scott MacKenzie el 24 de Jul. de 2021
I ran your code and I get a subplot with four graphs. Apparently you are not getting the 4th graph. Please post the output graph you are getting.
MICHKEL ANGLO J
MICHKEL ANGLO J el 24 de Jul. de 2021
@Scott MacKenzie here is the graph i got
Scott MacKenzie
Scott MacKenzie el 24 de Jul. de 2021
Hmm, that's wierd. What version of MATLAB are you running?
What about plotting something simple in subplot(4,1,4) -- just to narrow down the problem. Try commenting out lines 29-35 in your code (as posted above) and inserting...
subplot(4,1,4);
bar(rand(3));
Here's what I get:
Chunru
Chunru el 24 de Jul. de 2021
Are you sure you are running the same code as you posted? Can you step through the code in debug mode?
MICHKEL ANGLO J
MICHKEL ANGLO J el 24 de Jul. de 2021
@Chunru a just copy and paste code.so there is no change not only this program ,butter function is not working anyother program.
@Scott MacKenzie no sir i can't use bar charts because i want to prove 1st and 4th graph as equal.
Scott MacKenzie
Scott MacKenzie el 24 de Jul. de 2021
I'm only asking you to do this (create a bar chart in position 4) for debugging.
MICHKEL ANGLO J
MICHKEL ANGLO J el 24 de Jul. de 2021
ok i will do.
Chunru
Chunru el 25 de Jul. de 2021
Try "which butter" or "dbstop in butter".

Iniciar sesión para comentar.

 Respuesta aceptada

Chunru
Chunru el 24 de Jul. de 2021

0 votos

clc;
clear all;
close all;
m=1;
Am=5;
Fa=2000
Fa = 2000
ta=1/Fa;
t=0:ta/999:6*ta;
ym=Am*sin(2*pi*Fa*t);
subplot(4,1,1);
plot(t,ym);
title('message signal')
SNR=1
SNR = 1
Ac=5
Ac = 5
Fc=Fa*10;
tc=1/Fc
tc = 5.0000e-05
yc=Ac*sin(2*pi*Fc*t);
subplot(4,1,2);
plot(t,yc);
grid on;
title('carrier signal')
y=Ac.*(1+m*sin(2*pi*Fa*t)).*sin(2*pi*Fc*t);
subplot(4,1,3);
plot(t,y)
grid on;
title('Amplitude modulation');
s1=y.*yc;
[b,a]=butter(4,0.004);
s2=filter(b,a,s1);
subplot(4,1,4);
plot(s2);
grid on;
title('am demod');

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Productos

Versión

R2021a

Preguntada:

el 23 de Jul. de 2021

Comentada:

el 25 de Jul. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by