Generating and plotting result of upfirdn

3 次查看(过去 30 天)
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!

回答(1 个)

Walter Roberson
Walter Roberson 2017-6-24
编辑:Walter Roberson 2017-6-25
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 个评论
Walter Roberson
Walter Roberson 2017-6-25
It was a typo, sorry: you initialized to double precision so the sum will be double precision.
Walter Roberson
Walter Roberson 2017-6-25
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Filter Design 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by