Borrar filtros
Borrar filtros

Generating and plotting result of upfirdn

3 visualizaciones (últimos 30 días)
musedpony
musedpony el 24 de Jun. de 2017
Comentada: Walter Roberson el 25 de Jun. de 2017
I'm trying to pass rectangular pulses into a raised cosine filter to smooth the edges, then plot this result against time. It seems like upfirdn(xin,h,p,q) only accepts double-precision input for xin. However, I've defined my xin in terms of a sum of shifted rectangular pulses that encode user-input binary data – I'm not sure how to make the conversion to double-precision such that upfirdn will filter the square pulses and produce an output with the same information content but with smoothed edges (lower bandwidth). The final plot should look pretty much the same as the plot of m(t), but 'smoothed' out and like a sum of sinusoids.
I've attached the code for reference. Thanks for the help!

Respuestas (1)

Walter Roberson
Walter Roberson el 24 de Jun. de 2017
Editada: Walter Roberson el 25 de Jun. de 2017
You have
m = 0; % define the function m(t)
and then you add pulses to m. You are initializing m as double precision, so your final sum will be double precision. Therefore you already have double precision values for the first input to the raised cosine filter.
  3 comentarios
Walter Roberson
Walter Roberson el 25 de Jun. de 2017
It was a typo, sorry: you initialized to double precision so the sum will be double precision.
Walter Roberson
Walter Roberson el 25 de Jun. de 2017
I missed that you are passing sym t to rectangularPulse, so your m is going to be symbolic. You need to substitute a definite vector of times for t in your m before you call upfirdn. This is a problem because you have not defined your bit-time.
For example,
times = 0:N*T+T;
mm = double(subs(m,t,times));
x = upfirdn(mm, h, sps);
This will not be symbolic, so you will have difficulty plotting it with fplot. You will instead need to do something like
tvec = (0:length(x)-1)/sps;
plot(tvec, x);
However, I am not certain that this time vector is appropriate. I figure that length(x) is (length(mm)-1)*sps + length(h) but it is not obvious how to relate that to times, so I just assume that the samples are 1/sps apart

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by