0
$\begingroup$

I am using OFDM system in Matlab, I want to use an analog filter after the DAC. Because we don't a simulation for the DAC, the generated OFDM analog signal does not have a specific frequency (they only have normalized frequency). When I design the analog filter, I have to specify the frequency (not normalized frequency as in digital filters). So I am not able to filter my OFDM signal with the analog filter. Any ideas on how to do that? I have been trying to use slim Matlab command to do that, I managed to apply an analog filter on sinusoidal signals as follows:

clc
clear all
close all
f1 = 1000;                  % signal frequency
f2 = 2000;                  % signal frequency
f3 = 3000;                  % signal frequency
fs= 10000;                  % DAC sampling Rate
Ts= 1/fs;                   % DAC sampling time
N= 4000;                    % Number of points
n= 0:N-1;                   % sampling index
x= cos(2*pi*f1*n*Ts)+ cos(2*pi*f2*n*Ts)+cos(2*pi*f3*n*Ts);
df=-0.5:1/N:0.5-(1/N);      %frequency bins
X=fftshift(fft(x,N));
figure;plot(fs*df,abs(X)/N);    %original signal

%%
%filter design
order=14    % Filter order
Rs=30   %stopband attenuation
fc=1500; % filter cutoff frequency
[b,a] = cheby2(order,Rs,[2*pi*fc],'low','s');
figure;freqs(b,a);
% [z2,p2,k2] = cheby2(order,Rs,2*pi*fc,'low','s');
% [b2,a2] = zp2tf(z2,p2,k2);
% figure;freqs(b2,a2);
% [zeros, poles, gain] = butter(order,[2*pi*fc],'low','s'); %generate LPF zeros, poles, and filter gain.
% [b2,a2] = zp2tf(zeros, poles, gain); %convert to transfer function form of b, a coefficients
% figure;freqs(b2,a2);

%%
%apply the filter
% create system
myFilter = tf(b,a);
% apply filter to time domain signal
[y, time] = lsim(myFilter,x,n*Ts);
Y=fftshift(fft(y));
figure;plot(fs*df,abs(Y)/N);
$\endgroup$
  • $\begingroup$ same as your previous RRC question: you simply apply a digital filter that approximates the analog filter. There's no analog signals in your PC, and OFDM is a digital signal anyway, so only the digital equivalent of the analog system would matter to the receiver, anyway. $\endgroup$ – Marcus Müller Jun 18 at 9:06
  • $\begingroup$ I want to use an analog filters provided by Matlab, I know it is easy to use a digital filter and pretend that I am using an analog filter. please check my code, I made it for cos signals. I am trying to apply the same method on OFDM system. $\endgroup$ – omaro goneim Jun 18 at 9:48
  • 1
    $\begingroup$ @alyssaeliyah I said it before: Using code formatting for highlighting words is not appropriate. Please don't do that. If you want to emphasize something, use **bold** or *italics* formatting, not `source code` formatting. Even done right, this formating edit contribute little to the question itself, but every time you , as long as you have not a lot of reputation points, do an edit, it ends up in an edit queue that other people (such as me) have to process. So, you're actively binding time to do low-improvement edits! Please make sure an edit is really worth it. $\endgroup$ – Marcus Müller Jun 18 at 10:00
  • 1
    $\begingroup$ you've been told that by me two or three times, and by Andy. yes. yes you can. $\endgroup$ – Marcus Müller Jun 18 at 10:38
  • 1
    $\begingroup$ and I've never seen an analog RRC filter, so I doubt you actually even should want to simulate one. $\endgroup$ – Marcus Müller Jun 18 at 10:38
0
$\begingroup$

same as your previous RRC question: you simply apply a digital filter that approximates the analog filter.

There's no analog signals in your PC, and OFDM is a digital signal anyway, so only the digital equivalent of the analog system would matter to the receiver, anyway.

Look at it this way: You're supposed to simulate a digital system. Therefore, the receiver is digital. Therefore, the analog effects that would happen in a real-world transceiver system are only relevant in their digital form.

And if Nyquist has taught you anything, any band-limited analog system can be represented through a digital one.

So, stop worrying about building analog filters, but describe the thing you want to simulate and then implement that digitally.

(I mean, really! Look at the purpose of OFDM: it's a purely digital thing, meant to do the inverse to a purely analog multipath channel, which is an analog filter. It works. You don't have to model anything in analog, unless you're not really understanding what OFDM is about.)

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.