IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Signal Discussion :

Simulation OFDM canal multi trajet


Sujet :

Signal

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Janvier 2016
    Messages : 1
    Points : 1
    Points
    1
    Par défaut Simulation OFDM canal multi trajet
    Bonjour,
    Je me permet de poser cette question afin de pouvoir regler un gros soucie. j'ai realiser une chaine de transmission OFDM et en AWGN sa marche très bien. Donc l'idée c'est de passer dans un canal avec des multi trajet. je défini h = [0.8] et le code marche bien. par contre quand je met plus de tap h =[0.8 0.4 0.5], rien ne va. je suis novice en matlab et je voulais savoir si je pourrai avec quelques informations concernant ce que je fait pas bien dans le code.

    Cordialement
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    %--------OFDM TRANSMISSION CHAIN---------%
    close all;
    clearvars;
    % nfft and nsymbols
    n_sc = 512; % number of subcarriers
    n_symbol = 1000; % number of symbols
    ofdmBW = 26.2 * 10 ^ 6 ; % OFDM bandwidth
    Fs = 75 * 10 ^ 6;
    Ts = 1/Fs;
    % t = 0:1/Fs:1-1/Fs;
     
    %---modulation type---%
    M = 4; % QPSK
    k = log2(M);
    n_cp = 16;
    % channel type
    chan = 'awgn';
    EbNo = 0:50;
    SNR = EbNo + 10*log10(k)+10*log10(n_sc/(n_sc+n_cp));
    EbNoLin = 10.^(EbNo/10);
     
    % generating data
    x_source = randi([0,1],n_symbol*n_sc*k,1);
     
    % multipath channel
     
    % % h = [0.5*exp(1i*pi/2)];% 0.2 0.4];
    h = [0.8 0.5 0.4];
    % tx = [1 2 3]*1e-6;
    n = length(h);
    tx = [0:n-1]%*1e-9;
     
    % delay_rms = sqrt(sum((h.^2).*(tx.^2))/sum(h.^2)-(sum((h.^2).*tx)/sum(h.^2)).^2)
    % Bc=1/(50*delay_rms)
    figure (2)
    stem(tx,h)
    xlim([0 20])
     
    %insertion zero
    h1 = [h,zeros(1,528-n)];
    hF = (fft(h1,528));
    % [h,f]=freqz(h1);
    % plot(f,abs(h)) % réponse du canal
    % transfer fuction
    h2 = [h,zeros(1,512-n)];
    hf2 = (fft(h2,512));
     
    % channel = randn(6,1);
    % stem(10*log10(abs(channel)))
    % hF = fft(channel,512);
     
     
     
     
    %modulation
    for i = 1:length(EbNo)
    x_conversion = bi2de(reshape(x_source,k,numel(x_source)/k).','left-msb');
    x_modulation = pskmod(x_conversion,M,pi/4,'gray');
    % figure (1)
    % plot(real(x_modulation), imag(x_modulation),'o');
    % serial to parallel
    x_sp = reshape(x_modulation,n_sc,numel(x_modulation)/n_sc).';
    %IFFT
    x_ifft = ifft(x_sp,n_sc,2);
    %cyclic p ofdm_signal =[ x_Time( N-Ncp + 1: N) x_Time]; 
    x_cp = [x_ifft(:,n_sc-n_cp+1:n_sc),x_ifft];
     
    %%
     
    %convolution using fft frequency domain
    X_cp = fft(x_cp); % passe en freq
    for m = 1 : size(x_cp,1)
        Y(m,:) = hF.*X_cp(m,:);
    end
    x_conv = ifft(Y);
    % x_conv = convn(h1,x_cp);
        %add noise
         bruit = awgn(x_conv,SNR(i),'measured')- x_cp;
        %awgn
        y_awgn = x_conv+bruit;
     
        %remove CP
        y_cp = y_awgn(:,n_cp+1:end);
        %fft
        y_fft = fft(y_cp,n_sc,2);
    %      plot(real(y_fft(1:10,:)),imag(y_fft(1:10,:)),'o')
         % egalisation
        for m = 1 : size(x_cp,1)
            %y_egal(m,:) = y_fft(m,:);
           y_egal(m,:) = y_fft(m,:)./hf2;
        end
     
       % y_egal=y_fft./hf2;
     
    %   parallel to serial
        y_ps = reshape(y_fft.',numel(y_fft),1);
        %demodulation
        y_demodulation = pskdemod(y_ps,M,pi/4,'gray');
        y_conversion = de2bi(y_demodulation,'left-msb');
        y_sortie = reshape(y_conversion.',numel(y_conversion),1);
        %BER counter
        ber(i) = sum(x_source~=y_sortie)/numel(x_source);
    end
    %plot
    % BER = berawgn(EbNo,'psk',M,'nondiff');
     
    % ber théorique
    for i = 1:length(EbNo)
        berth(i)=0;
        for w =1:n_sc
            EbNow=10*log10(abs(hf2(w))^2)+SNR(i)-10*log10(k)+10*log10(n_sc/(n_sc+n_cp));
            %EbNow=10*log10(abs(0.5^2))+SNR(i)-10*log10(k)+10*log10(n_sc/(n_sc+n_cp));
            berth(i)=berth(i)+0.5*erfc(sqrt(10.^(EbNow/10)));
        end
        berth(i)=berth(i)/n_sc;
    end
     
    BERawgn = berawgn(EbNo,'psk',M,'nondiff');
     
    figure(5)
    semilogy(EbNo,BERawgn,EbNo,berth,EbNo,ber,'r - o','linewidth',2);
    title(' BER Vs EbNo for OFDM with QPSK modulation over Rayleigh channel'); 
    xlabel(' Eb/ N0 (dB)'); 
    ylabel(' BER'); 
    legend(' awgn','theoretical Ray',' simulated');
    % xlabel('EbNo(dB)')
    % ylabel('BER')
    axis([EbNo(1) EbNo(end) 1e-5 1])
    % axis([EbNo(1) EbNo(end) 0 0])
    ber

    désolé pour les emo c tout(deux point) sur matlab

  2. #2
    Membre à l'essai
    Femme Profil pro
    Inscrit en
    Février 2013
    Messages
    19
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Algérie

    Informations forums :
    Inscription : Février 2013
    Messages : 19
    Points : 23
    Points
    23
    Par défaut
    Citation Envoyé par purplerain01 Voir le message
    Bonjour,
    Je me permet de poser cette question afin de pouvoir regler un gros soucie. j'ai realiser une chaine de transmission OFDM et en AWGN sa marche très bien. Donc l'idée c'est de passer dans un canal avec des multi trajet. je défini h = [0.8] et le code marche bien. par contre quand je met plus de tap h =[0.8 0.4 0.5], rien ne va. je suis novice en matlab et je voulais savoir si je pourrai avec quelques informations concernant ce que je fait pas bien dans le code.

    Cordialement
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    %--------OFDM TRANSMISSION CHAIN---------%
    close all;
    clearvars;
    % nfft and nsymbols
    n_sc = 512; % number of subcarriers
    n_symbol = 1000; % number of symbols
    ofdmBW = 26.2 * 10 ^ 6 ; % OFDM bandwidth
    Fs = 75 * 10 ^ 6;
    Ts = 1/Fs;
    % t = 0:1/Fs:1-1/Fs;
     
    %---modulation type---%
    M = 4; % QPSK
    k = log2(M);
    n_cp = 16;
    % channel type
    chan = 'awgn';
    EbNo = 0:50;
    SNR = EbNo + 10*log10(k)+10*log10(n_sc/(n_sc+n_cp));
    EbNoLin = 10.^(EbNo/10);
     
    % generating data
    x_source = randi([0,1],n_symbol*n_sc*k,1);
     
    % multipath channel
     
    % % h = [0.5*exp(1i*pi/2)];% 0.2 0.4];
    h = [0.8 0.5 0.4];
    % tx = [1 2 3]*1e-6;
    n = length(h);
    tx = [0:n-1]%*1e-9;
     
    % delay_rms = sqrt(sum((h.^2).*(tx.^2))/sum(h.^2)-(sum((h.^2).*tx)/sum(h.^2)).^2)
    % Bc=1/(50*delay_rms)
    figure (2)
    stem(tx,h)
    xlim([0 20])
     
    %insertion zero
    h1 = [h,zeros(1,528-n)];
    hF = (fft(h1,528));
    % [h,f]=freqz(h1);
    % plot(f,abs(h)) % réponse du canal
    % transfer fuction
    h2 = [h,zeros(1,512-n)];
    hf2 = (fft(h2,512));
     
    % channel = randn(6,1);
    % stem(10*log10(abs(channel)))
    % hF = fft(channel,512);
     
     
     
     
    %modulation
    for i = 1:length(EbNo)
    x_conversion = bi2de(reshape(x_source,k,numel(x_source)/k).','left-msb');
    x_modulation = pskmod(x_conversion,M,pi/4,'gray');
    % figure (1)
    % plot(real(x_modulation), imag(x_modulation),'o');
    % serial to parallel
    x_sp = reshape(x_modulation,n_sc,numel(x_modulation)/n_sc).';
    %IFFT
    x_ifft = ifft(x_sp,n_sc,2);
    %cyclic p ofdm_signal =[ x_Time( N-Ncp + 1: N) x_Time]; 
    x_cp = [x_ifft(:,n_sc-n_cp+1:n_sc),x_ifft];
     
    %%
     
    %convolution using fft frequency domain
    X_cp = fft(x_cp); % passe en freq
    for m = 1 : size(x_cp,1)
        Y(m,:) = hF.*X_cp(m,:);
    end
    x_conv = ifft(Y);
    % x_conv = convn(h1,x_cp);
        %add noise
         bruit = awgn(x_conv,SNR(i),'measured')- x_cp;
        %awgn
        y_awgn = x_conv+bruit;
     
        %remove CP
        y_cp = y_awgn(:,n_cp+1:end);
        %fft
        y_fft = fft(y_cp,n_sc,2);
    %      plot(real(y_fft(1:10,:)),imag(y_fft(1:10,:)),'o')
         % egalisation
        for m = 1 : size(x_cp,1)
            %y_egal(m,:) = y_fft(m,:);
           y_egal(m,:) = y_fft(m,:)./hf2;
        end
     
       % y_egal=y_fft./hf2;
     
    %   parallel to serial
        y_ps = reshape(y_fft.',numel(y_fft),1);
        %demodulation
        y_demodulation = pskdemod(y_ps,M,pi/4,'gray');
        y_conversion = de2bi(y_demodulation,'left-msb');
        y_sortie = reshape(y_conversion.',numel(y_conversion),1);
        %BER counter
        ber(i) = sum(x_source~=y_sortie)/numel(x_source);
    end
    %plot
    % BER = berawgn(EbNo,'psk',M,'nondiff');
     
    % ber théorique
    for i = 1:length(EbNo)
        berth(i)=0;
        for w =1:n_sc
            EbNow=10*log10(abs(hf2(w))^2)+SNR(i)-10*log10(k)+10*log10(n_sc/(n_sc+n_cp));
            %EbNow=10*log10(abs(0.5^2))+SNR(i)-10*log10(k)+10*log10(n_sc/(n_sc+n_cp));
            berth(i)=berth(i)+0.5*erfc(sqrt(10.^(EbNow/10)));
        end
        berth(i)=berth(i)/n_sc;
    end
     
    BERawgn = berawgn(EbNo,'psk',M,'nondiff');
     
    figure(5)
    semilogy(EbNo,BERawgn,EbNo,berth,EbNo,ber,'r - o','linewidth',2);
    title(' BER Vs EbNo for OFDM with QPSK modulation over Rayleigh channel'); 
    xlabel(' Eb/ N0 (dB)'); 
    ylabel(' BER'); 
    legend(' awgn','theoretical Ray',' simulated');
    % xlabel('EbNo(dB)')
    % ylabel('BER')
    axis([EbNo(1) EbNo(end) 1e-5 1])
    % axis([EbNo(1) EbNo(end) 0 0])
    ber

    désolé pour les emo c tout(deux point) sur matlab
    ..................................................................................................................
    Bonjour,
    Vous pouvez après la ifft et l'insertion du préfixe cyclique appliquer directement le canal multitrajet par la convulotion ç.à.d.
    au lieu de : X_cp = fft(x_cp); % passe en freq
    for m = 1 : size(x_cp,1)
    Y(m, = hF.*X_cp(m,;
    end
    x_conv = ifft(Y);

    vous pouvez faire directement: x_conv= conv(h,x_cp);

    et concernant la commande awgn, cette dernière vous donne directement le signal bruité avec le snr donné, ç.à.d.
    y_awgn=awgn(x_conv,SNR(i),'measured'); le résultat est x_conv bruité avec snr donné.

  3. #3
    Candidat au Club
    Inscrit en
    Novembre 2009
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Novembre 2009
    Messages : 3
    Points : 4
    Points
    4
    Par défaut emission et reception d'un signal alternatif via un canal radiomobile (canal de rayleigh)
    svp j'ai besoin d'un code pour receptionner ne signal alternatif emis si possible aussi comment evaluer le taux d'erreur?
    merci d'avance pour votre aide
    % Reponse d'un canal de rayleigh a un signal d'entré alternatif
    %c = rayleighchan(1/3000,100);% definition du canal de rayleigh
    c = rayleighchan(1/3000, 100, [0 1.5e-5 3.2e-5], [0, -3, -3]);
    %temps d'echatillonage 1/10000 (s)
    % La durée maximale de Doppler des composantes diffuses (Hz)
    w = 0:2*pi/200:2*pi; % signal alternative
    s = 2*cos(2*w); % signal alternative
    y = filter(c,s); % passage du signal dans a travers le canal
    c % afficher les proprieté du canal

    % trace la puissance du signal du fading
    plot(20*log10(abs(y)))
    title('reponse du canal a un signal alternatif')
    ylabel('puissance(db)')
    xlabel('frequence (Hz)')
    legend('Te=1/3000') % pour rajouter une légende
    grid

Discussions similaires

  1. [Débutant] Simulation OFDM (allocation des ressources)
    Par Mohammed KASRI dans le forum Signal
    Réponses: 0
    Dernier message: 11/05/2014, 22h08
  2. Simulation OFDM
    Par polo29sud dans le forum Calcul scientifique
    Réponses: 4
    Dernier message: 27/02/2012, 21h55
  3. [Cookies] simuler cookie multi-domaine - presque
    Par sunshine33 dans le forum Langage
    Réponses: 1
    Dernier message: 06/02/2008, 13h48
  4. Réponses: 1
    Dernier message: 11/07/2007, 22h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo