Raised Cosine Filter for Matlab
10 views (last 30 days)
Show older comments
Nathan Jaqua
on 15 Mar 2020
Answered: Sriram Tadavarty
on 16 Mar 2020
We are designing a raised cosine filter in Matlab. I have done the logic for the BPSK Transmitter and am now working on finishing the Raised Cosine Filter. I seem to be having some trouble with the upfirdn and fDly functions, and setting beta and span to the correct settings. I keep either exceeding the array elements or getting in errors in rcosdesign.
Program is attached to this post
0 Comments
Accepted Answer
Sriram Tadavarty
on 16 Mar 2020
Hi Nathan,
The usage of rcosdesign function in the code is correct, but the usage of upfirdn function is incorrect.
The input bits are not passed to the upsample FIR filter function, instead beta (roll off factor is sent). Pass the bits and that would solve the issue. The code comment is apt but the input sent is beta instead of beta.
b = rcosdesign(beta,span,sps); % Design a filter object
x = upfirdn( bits, span,sps ); % Pass bits from a filter
For more details on the usage of rcosdesign, go through this page https://www.mathworks.com/help/signal/ref/rcosdesign.html
Examples 3 and 4 provide some insights of how to apply for your case.
I see some wrong usage in the plot command too. Here is the doc page for plot command https://www.mathworks.com/help/matlab/ref/plot.html
The indexing is not correct while accessing x and xx in the plot. Here is some information about this https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html
The code comments didn't provide me any insights of what you are trying to plot. But, here are some suggestions for the code.
figure;
plot(x(1: 100)); hold on; grid on;
plot(xx(1:100))
% append zeros to compensate filter delay. Filter delay = length(filter object - 1)/2
fDly = (length( b) - 1)/ 2; % There is no filter object. May i know what is intended here.
plot([xx; zeros(fDly ,1)]);
Hope this helps.
Regards,
Sriram
0 Comments
More Answers (0)
See Also
Categories
Find more on Digital Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!