Thread Subject: MC-CDMA simulation using Matlab

Subject: MC-CDMA simulation using Matlab

From: BULDO

Date: 22 Mar, 2008 02:21:35

Message: 1 of 11

I am simulating MC-CDMA using Matlab. Here is the message Maltab
returned when I ran the simulation:

Undefined function or method 'snr' for input arguments of type 'char'.
Error in ==> MCCDMA at 10
snr _in_ dB = 0:1:15;

I am using Matlab 2007b and the Matlab code is:


% MCCDMA %
% for simulation %
%%%%%%%%%%%%%%%%%%%%
%%% Transmitter Model %%%
clear all;
clc;close all;
tic; % start a stopwatch timer
xaxis=[];
yaxis=[];
snr _in_ dB = 0:1:15;
R= 100;
for n=1:lentgh(snr_in_dB)
    no_of_errors=0;
    for m=1:R
        N=8; %no of subchannels
        ifft_size=N; %ifft size
        fft_size=N; %fft size
        M=100000; % nos of data in each subchannel
        total_no_of_data= N*M;
    rand_data_seed=11;
    % Generation of N parallel dada sequence
    rand('seed',rand_data_seed);
    user_data_matrix=rand(N,M);
    user_data_matrix=(user_data_matrix>0.5)*2-1;
    % Calling of function for code matrix
    code_mat=code_matrix(N,'hada_11');
    trans_code_mat_out=(conj(code_mat))*user_data_matrix;
    % IFFT of the code matrix out
    trans_ifft_out=iff(trans_code_mat_out,ifft_size);
    % Normalization of IFFT
    trans_ifft_out_nor=trans_ifft_out* sqrt(N);
    % Parallel to serial of transmit signal
    trans_sig_serial=reshape(trans_ifft_out_nor,1,N*M);
    recv_sig_serial=trans_sig_serial;
    %%% Receiver Model %%%
    % Serial to parallel for received signal
    recv_signal_parallel=reshape(recv_signal_serial,N*M);
    % Taking FFT of the received signal(parallel)
    recv_fft_out=fft(recv_signal_parallel,fft_size);
    % Normalization of the FFT
    recv_fft_out_nor=recv_fft_out/sqrt(N);
    % Calling function for weight matrix
    [weight_mat,diag_h]=weight_mat(N,'awgn');
    % Multiplication of Rayleigh Noise with FFT out
    recv_fft_out_rayleigh=diag_h*recv_fft_out_nor;
    % Addition of AWGN
 
recv_fft_awgn_out=awgn(recv_fft_out_rayleig,SNR_in_dB(n),'measured');
    recv_fft_out_noise=recv_fft_awgn_out-recv_fft_out_rayleigh;
    recv_fft_awgn_out=recv_fft_out_rayleigh+(recv_fft_out_noise/
sqrt(2));
    % Multiplication by weight matrix
    recv_wmat_out=weight_mat*recv_fft_awgn_out;
    % Taking inverse of code matrix
    inv_code_mat=inv(code_mat);
    % Multiplication by Inverse Code Matrix
    out_data_parallel=inv_code_mat*(recv_wmat_out);
    % Taking real part of the out_data_ parallel matrix
    real_out_data_parallel=real(out_data_parallel);
    % Converting the real_out_parallel matrix to '1' and '-1'
    out_user_data_matrix=(real_out_data_parallel>0)*2-1;
    % Parallel to serial conversion of out data
    out_data_serial=reshape(out_user_data_matrix,1,N*M);
    %%% calculation of bit error rate %%%
    % regeneration of transmitted user data matrix
    rand('seed',rand_data_seed);
    trans_user_data_matrix=rand(N,M);
    trans_user_data_matrix=(trans_user_data_matrix>0.5)*2-1;
    % Calculation of bit error rate
 
[no_of_errors,symbol_error_rate]=symerr(trans_user_data_matrix,out_user_data_matrix);
    no_of_errors=no_of_errors+no_of_errors;
    end;
    sym_err_rate=no_of_errors/total_no_of_data;
    ber_simulated=sym_err_rate/1.0;
    ber_simulated;
    yaxis=[yaxis,ber_simulated];
end;
xaxis=[xaxis,SNR_in_dB];
% Save BER for different SNR
save ybhawgns.mat yaxis;
% Plotting command follows
seminolog(xaxis,yyaxis,'g-');
ylabel('.............SNR(dB).............');
ylabel('.............AverageBER..........');
axis([0 17 0.000001 0.1]);
toc; % read the stop watchtimer,print time in second
%%% End of program %%%



   Thanks for you help,take care!

Subject: MC-CDMA simulation using Matlab

From: Amir

Date: 22 Mar, 2008 02:45:04

Message: 2 of 11

BULDO <mikailidirs@gmail.com> wrote in message <5452bf3f-
bdde-41b0-97c6-
25b5ee902e78@i29g2000prf.googlegroups.com>...
> I am simulating MC-CDMA using Matlab. Here is the
message Maltab
> returned when I ran the simulation:
>
> Undefined function or method 'snr' for input arguments
of type 'char'.
> Error in ==> MCCDMA at 10
> snr _in_ dB = 0:1:15;
>
> I am using Matlab 2007b and the Matlab code is:
>
>
> % MCCDMA %
> % for simulation %
> %%%%%%%%%%%%%%%%%%%%
> %%% Transmitter Model %%%
> clear all;
> clc;close all;
> tic; % start a stopwatch timer
> xaxis=[];
> yaxis=[];
> snr _in_ dB = 0:1:15;
> R= 100;
> for n=1:lentgh(snr_in_dB)
> no_of_errors=0;
> for m=1:R
> N=8; %no of subchannels
> ifft_size=N; %ifft size
> fft_size=N; %fft size
> M=100000; % nos of data in each subchannel
> total_no_of_data= N*M;
> rand_data_seed=11;
> % Generation of N parallel dada sequence
> rand('seed',rand_data_seed);
> user_data_matrix=rand(N,M);
> user_data_matrix=(user_data_matrix>0.5)*2-1;
> % Calling of function for code matrix
> code_mat=code_matrix(N,'hada_11');
> trans_code_mat_out=(conj(code_mat))*user_data_matrix;
> % IFFT of the code matrix out
> trans_ifft_out=iff(trans_code_mat_out,ifft_size);
> % Normalization of IFFT
> trans_ifft_out_nor=trans_ifft_out* sqrt(N);
> % Parallel to serial of transmit signal
> trans_sig_serial=reshape(trans_ifft_out_nor,1,N*M);
> recv_sig_serial=trans_sig_serial;
> %%% Receiver Model %%%
> % Serial to parallel for received signal
> recv_signal_parallel=reshape(recv_signal_serial,N*M);
> % Taking FFT of the received signal(parallel)
> recv_fft_out=fft(recv_signal_parallel,fft_size);
> % Normalization of the FFT
> recv_fft_out_nor=recv_fft_out/sqrt(N);
> % Calling function for weight matrix
> [weight_mat,diag_h]=weight_mat(N,'awgn');
> % Multiplication of Rayleigh Noise with FFT out
> recv_fft_out_rayleigh=diag_h*recv_fft_out_nor;
> % Addition of AWGN
>
> recv_fft_awgn_out=awgn(recv_fft_out_rayleig,SNR_in_dB
(n),'measured');
> recv_fft_out_noise=recv_fft_awgn_out-
recv_fft_out_rayleigh;
> recv_fft_awgn_out=recv_fft_out_rayleigh+
(recv_fft_out_noise/
> sqrt(2));
> % Multiplication by weight matrix
> recv_wmat_out=weight_mat*recv_fft_awgn_out;
> % Taking inverse of code matrix
> inv_code_mat=inv(code_mat);
> % Multiplication by Inverse Code Matrix
> out_data_parallel=inv_code_mat*(recv_wmat_out);
> % Taking real part of the out_data_ parallel matrix
> real_out_data_parallel=real(out_data_parallel);
> % Converting the real_out_parallel matrix to '1'
and '-1'
> out_user_data_matrix=(real_out_data_parallel>0)*2-1;
> % Parallel to serial conversion of out data
> out_data_serial=reshape(out_user_data_matrix,1,N*M);
> %%% calculation of bit error rate %%%
> % regeneration of transmitted user data matrix
> rand('seed',rand_data_seed);
> trans_user_data_matrix=rand(N,M);
> trans_user_data_matrix=(trans_user_data_matrix>0.5)
*2-1;
> % Calculation of bit error rate
>
> [no_of_errors,symbol_error_rate]=symerr
(trans_user_data_matrix,out_user_data_matrix);
> no_of_errors=no_of_errors+no_of_errors;
> end;
> sym_err_rate=no_of_errors/total_no_of_data;
> ber_simulated=sym_err_rate/1.0;
> ber_simulated;
> yaxis=[yaxis,ber_simulated];
> end;
> xaxis=[xaxis,SNR_in_dB];
> % Save BER for different SNR
> save ybhawgns.mat yaxis;
> % Plotting command follows
> seminolog(xaxis,yyaxis,'g-');
> ylabel('.............SNR(dB).............');
> ylabel('.............AverageBER..........');
> axis([0 17 0.000001 0.1]);
> toc; % read the stop watchtimer,print time
in second
> %%% End of program %%%
>
>
>
> Thanks for you help,take care!



You have a typo in that line. You have a space between snr
and _in_ dB:

snr _in_ dB = 0:1:15; wrong, space after snr
snr_in_ dB = 0:1:15; %Correct, no space after snr

Subject: MC-CDMA simulation using Matlab

From: BULDO

Date: 22 Mar, 2008 03:18:10

Message: 3 of 11

Thanks for your help, but after i corrected the previous mistake, i
got a new error:??? Undefined function or method 'lentgh' for input
arguments of type 'double'.

Error in =3D=3D> MCCDMA at 12
for n=3D1:lentgh(snr_in_dB)
Take care!
On Mar 22, 10:45=A0am, "Amir " <amir_se...@yahoo.com> wrote:
> BULDO <mikailid...@gmail.com> wrote in message <5452bf3f-
>
> bdde-41b0-97c6-
> 25b5ee902...@i29g2000prf.googlegroups.com>...
>
>
>
> > I am simulating MC-CDMA using Matlab. Here is the
> message Maltab
> > returned when I ran the simulation:
>
> > Undefined function or method 'snr' for input arguments
> of type 'char'.
> > Error in =3D=3D> MCCDMA at 10
> > snr _in_ dB =3D 0:1:15;
>
> > I am using Matlab 2007b and the Matlab code is:
>
> > % MCCDMA %
> > % for simulation %
> > %%%%%%%%%%%%%%%%%%%%
> > %%% Transmitter Model %%%
> > clear all;
> > clc;close all;
> > tic; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0% start a stopwatch timer
> > xaxis=3D[];
> > yaxis=3D[];
> > snr _in_ dB =3D 0:1:15;
> > R=3D 100;
> > for n=3D1:lentgh(snr_in_dB)
> > =A0 =A0 no_of_errors=3D0;
> > =A0 =A0 for m=3D1:R
> > =A0 =A0 =A0 =A0 N=3D8; =A0 =A0 =A0 =A0 =A0 =A0%no of subchannels
> > =A0 =A0 =A0 =A0 ifft_size=3DN; =A0 =A0%ifft size
> > =A0 =A0 =A0 =A0 fft_size=3DN; =A0 =A0 %fft size
> > =A0 =A0 =A0 =A0 M=3D100000; =A0 =A0 =A0% nos of data in each subchannel
> > =A0 =A0 =A0 =A0 total_no_of_data=3D N*M;
> > =A0 =A0 rand_data_seed=3D11;
> > =A0 =A0 % Generation of N parallel dada sequence
> > =A0 =A0 rand('seed',rand_data_seed);
> > =A0 =A0 user_data_matrix=3Drand(N,M);
> > =A0 =A0 user_data_matrix=3D(user_data_matrix>0.5)*2-1;
> > =A0 =A0 % Calling of function for code matrix
> > =A0 =A0 code_mat=3Dcode_matrix(N,'hada_11');
> > =A0 =A0 trans_code_mat_out=3D(conj(code_mat))*user_data_matrix;
> > =A0 =A0 % IFFT of the code matrix out
> > =A0 =A0 trans_ifft_out=3Diff(trans_code_mat_out,ifft_size);
> > =A0 =A0 % Normalization of IFFT
> > =A0 =A0 trans_ifft_out_nor=3Dtrans_ifft_out* sqrt(N);
> > =A0 =A0 % Parallel to serial of transmit signal
> > =A0 =A0 trans_sig_serial=3Dreshape(trans_ifft_out_nor,1,N*M);
> > =A0 =A0 recv_sig_serial=3Dtrans_sig_serial;
> > =A0 =A0 %%% Receiver Model %%%
> > =A0 =A0 % Serial to parallel for received signal
> > =A0 =A0 recv_signal_parallel=3Dreshape(recv_signal_serial,N*M);
> > =A0 =A0 % Taking FFT of the received signal(parallel)
> > =A0 =A0 recv_fft_out=3Dfft(recv_signal_parallel,fft_size);
> > =A0 =A0 % Normalization of the FFT
> > =A0 =A0 recv_fft_out_nor=3Drecv_fft_out/sqrt(N);
> > =A0 =A0 % Calling function for weight matrix
> > =A0 =A0 [weight_mat,diag_h]=3Dweight_mat(N,'awgn');
> > =A0 =A0 % Multiplication of Rayleigh Noise with FFT out
> > =A0 =A0 recv_fft_out_rayleigh=3Ddiag_h*recv_fft_out_nor;
> > =A0 =A0 % Addition of AWGN
>
> > recv_fft_awgn_out=3Dawgn(recv_fft_out_rayleig,SNR_in_dB
> (n),'measured');
> > =A0 =A0 recv_fft_out_noise=3Drecv_fft_awgn_out-
>
> recv_fft_out_rayleigh;> =A0 =A0 recv_fft_awgn_out=3Drecv_fft_out_rayleigh+=

>
> (recv_fft_out_noise/
>
>
>
> > sqrt(2));
> > =A0 =A0 % Multiplication by weight matrix
> > =A0 =A0 recv_wmat_out=3Dweight_mat*recv_fft_awgn_out;
> > =A0 =A0 % Taking inverse of code matrix
> > =A0 =A0 inv_code_mat=3Dinv(code_mat);
> > =A0 =A0 % Multiplication by Inverse Code Matrix
> > =A0 =A0 out_data_parallel=3Dinv_code_mat*(recv_wmat_out);
> > =A0 =A0 % Taking real part of the out_data_ parallel matrix
> > =A0 =A0 real_out_data_parallel=3Dreal(out_data_parallel);
> > =A0 =A0 % Converting the real_out_parallel matrix to '1'
> and '-1'
> > =A0 =A0 out_user_data_matrix=3D(real_out_data_parallel>0)*2-1;
> > =A0 =A0 % Parallel to serial conversion of out data
> > =A0 =A0 out_data_serial=3Dreshape(out_user_data_matrix,1,N*M);
> > =A0 =A0 %%% calculation of bit error rate %%%
> > =A0 =A0 % regeneration of transmitted user data matrix
> > =A0 =A0 rand('seed',rand_data_seed);
> > =A0 =A0 trans_user_data_matrix=3Drand(N,M);
> > =A0 =A0 trans_user_data_matrix=3D(trans_user_data_matrix>0.5)
> *2-1;
> > =A0 =A0 % Calculation of bit error rate
>
> > [no_of_errors,symbol_error_rate]=3Dsymerr
>
> (trans_user_data_matrix,out_user_data_matrix);
>
>
>
>
>
> > =A0 =A0 no_of_errors=3Dno_of_errors+no_of_errors;
> > =A0 =A0 end;
> > =A0 =A0 sym_err_rate=3Dno_of_errors/total_no_of_data;
> > =A0 =A0 ber_simulated=3Dsym_err_rate/1.0;
> > =A0 =A0 ber_simulated;
> > =A0 =A0 yaxis=3D[yaxis,ber_simulated];
> > end;
> > xaxis=3D[xaxis,SNR_in_dB];
> > % Save BER for different SNR
> > save ybhawgns.mat yaxis;
> > % Plotting command follows
> > seminolog(xaxis,yyaxis,'g-');
> > ylabel('.............SNR(dB).............');
> > ylabel('.............AverageBER..........');
> > axis([0 17 0.000001 0.1]);
> > toc; =A0 =A0 =A0 =A0 =A0 =A0 =A0% read the stop watchtimer,print time
> in second
> > %%% =A0End of program =A0 =A0 =A0%%%
>
> > =A0 =A0Thanks for you help,take care!
>
> You have a typo in that line. You have a space between snr
> and _in_ dB:
>
> snr _in_ dB =3D 0:1:15; wrong, space after snr
> snr_in_ dB =3D 0:1:15; %Correct, no space after snr- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Subject: MC-CDMA simulation using Matlab

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 22 Mar, 2008 05:25:01

Message: 4 of 11

In article <0612995c-3e43-424b-94c7-cc9d566afe65@s12g2000prg.googlegroups.com>,
BULDO <mikailidirs@gmail.com> wrote:
>Thanks for your help, but after i corrected the previous mistake, i
>got a new error:??? Undefined function or method 'lentgh' for input
>arguments of type 'double'.

Try 'length' instead of 'lentgh'.
--
  "Product of a myriad various minds and contending tongues, compact of
  obscure and minute association, a language has its own abundant and
  often recondite laws, in the habitual and summary recognition of
  which scholarship consists." -- Walter Pater

Subject: MC-CDMA simulation using Matlab

From: BULDO

Date: 22 Mar, 2008 08:54:30

Message: 5 of 11

On Mar 22, 1:25=A0pm, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
wrote:
> In article <0612995c-3e43-424b-94c7-cc9d566af...@s12g2000prg.googlegroups.=
com>,
>
> BULDO =A0<mikailid...@gmail.com> wrote:
> >Thanks for your help, but after i corrected the previous mistake, i
> >got a new error:??? Undefined function or method 'lentgh' for input
> >arguments of type 'double'.
>
> Try 'length' instead of 'lentgh'.
> --
> =A0 "Product of a myriad various minds and contending tongues, compact of
> =A0 obscure and minute association, a language has its own abundant and
> =A0 often recondite laws, in the habitual and summary recognition of
> =A0 which scholarship consists." =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- Walter =
Pater

Thanks a lot Walter Pater,
But this doesn't solve the problem. Take care!

Subject: MC-CDMA simulation using Matlab

From: Mikail

Date: 22 Mar, 2008 09:51:02

Message: 6 of 11

Hi,
Thanks for your help,but this didn't solve the problem.
Regars
roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fs257d$7kc$1@canopus.cc.umanitoba.ca>...
> In article <0612995c-3e43-424b-94c7-
cc9d566afe65@s12g2000prg.googlegroups.com>,
> BULDO <mikailidirs@gmail.com> wrote:
> >Thanks for your help, but after i corrected the previous
mistake, i
> >got a new error:??? Undefined function or
method 'lentgh' for input
> >arguments of type 'double'.
>
> Try 'length' instead of 'lentgh'.
> --
> "Product of a myriad various minds and contending
tongues, compact of
> obscure and minute association, a language has its own
abundant and
> often recondite laws, in the habitual and summary
recognition of
> which scholarship consists." -- Walter
Pater

Subject: MC-CDMA simulation using Matlab

From: Logan Wolverine

Date: 30 Mar, 2008 07:29:04

Message: 7 of 11

BULDO <mikailidirs@gmail.com> wrote in message
<5452bf3f-bdde-41b0-97c6-25b5ee902e78@i29g2000prf.googlegroups.com>...
> I am simulating MC-CDMA using Matlab. Here is the message
Maltab
> returned when I ran the simulation:
>
> Undefined function or method 'snr' for input arguments of
type 'char'.
> Error in ==> MCCDMA at 10
> snr _in_ dB = 0:1:15;
>
> I am using Matlab 2007b and the Matlab code is:
>
>
> % MCCDMA %
> % for simulation %
> %%%%%%%%%%%%%%%%%%%%
> %%% Transmitter Model %%%
> clear all;
> clc;close all;
> tic; % start a stopwatch timer
> xaxis=[];
> yaxis=[];
> snr _in_ dB = 0:1:15;
> R= 100;
> for n=1:lentgh(snr_in_dB)
> no_of_errors=0;
> for m=1:R
> N=8; %no of subchannels
> ifft_size=N; %ifft size
> fft_size=N; %fft size
> M=100000; % nos of data in each subchannel
> total_no_of_data= N*M;
> rand_data_seed=11;
> % Generation of N parallel dada sequence
> rand('seed',rand_data_seed);
> user_data_matrix=rand(N,M);
> user_data_matrix=(user_data_matrix>0.5)*2-1;
> % Calling of function for code matrix
> code_mat=code_matrix(N,'hada_11');
> trans_code_mat_out=(conj(code_mat))*user_data_matrix;
> % IFFT of the code matrix out
> trans_ifft_out=iff(trans_code_mat_out,ifft_size);
> % Normalization of IFFT
> trans_ifft_out_nor=trans_ifft_out* sqrt(N);
> % Parallel to serial of transmit signal
> trans_sig_serial=reshape(trans_ifft_out_nor,1,N*M);
> recv_sig_serial=trans_sig_serial;
> %%% Receiver Model %%%
> % Serial to parallel for received signal
> recv_signal_parallel=reshape(recv_signal_serial,N*M);
> % Taking FFT of the received signal(parallel)
> recv_fft_out=fft(recv_signal_parallel,fft_size);
> % Normalization of the FFT
> recv_fft_out_nor=recv_fft_out/sqrt(N);
> % Calling function for weight matrix
> [weight_mat,diag_h]=weight_mat(N,'awgn');
> % Multiplication of Rayleigh Noise with FFT out
> recv_fft_out_rayleigh=diag_h*recv_fft_out_nor;
> % Addition of AWGN
>
>
recv_fft_awgn_out=awgn(recv_fft_out_rayleig,SNR_in_dB(n),'measured');
>
recv_fft_out_noise=recv_fft_awgn_out-recv_fft_out_rayleigh;
>
recv_fft_awgn_out=recv_fft_out_rayleigh+(recv_fft_out_noise/
> sqrt(2));
> % Multiplication by weight matrix
> recv_wmat_out=weight_mat*recv_fft_awgn_out;
> % Taking inverse of code matrix
> inv_code_mat=inv(code_mat);
> % Multiplication by Inverse Code Matrix
> out_data_parallel=inv_code_mat*(recv_wmat_out);
> % Taking real part of the out_data_ parallel matrix
> real_out_data_parallel=real(out_data_parallel);
> % Converting the real_out_parallel matrix to '1' and '-1'
> out_user_data_matrix=(real_out_data_parallel>0)*2-1;
> % Parallel to serial conversion of out data
> out_data_serial=reshape(out_user_data_matrix,1,N*M);
> %%% calculation of bit error rate %%%
> % regeneration of transmitted user data matrix
> rand('seed',rand_data_seed);
> trans_user_data_matrix=rand(N,M);
> trans_user_data_matrix=(trans_user_data_matrix>0.5)*2-1;
> % Calculation of bit error rate
>
>
[no_of_errors,symbol_error_rate]=symerr(trans_user_data_matrix,out_user_data_matrix);
> no_of_errors=no_of_errors+no_of_errors;
> end;
> sym_err_rate=no_of_errors/total_no_of_data;
> ber_simulated=sym_err_rate/1.0;
> ber_simulated;
> yaxis=[yaxis,ber_simulated];
> end;
> xaxis=[xaxis,SNR_in_dB];
> % Save BER for different SNR
> save ybhawgns.mat yaxis;
> % Plotting command follows
> seminolog(xaxis,yyaxis,'g-');
> ylabel('.............SNR(dB).............');
> ylabel('.............AverageBER..........');
> axis([0 17 0.000001 0.1]);
> toc; % read the stop watchtimer,print time in
second
> %%% End of program %%%
>
>
>
> Thanks for you help,take care!

I hav Got an error of line 26
"Undefined command/function 'code_matrix'.

Error in ==> Mc at 26
    code_mat=code_matrix(N,'hada_11');"

Can anyone please help me on that error......


Subject: MC-CDMA simulation using Matlab

From: lenin ram

Date: 31 Oct, 2008 15:28:02

Message: 8 of 11

BULDO <mikailidirs@gmail.com> wrote in message <5452bf3f-bdde-41b0-97c6-25b5ee902e78@i29g2000prf.googlegroups.com>...
> I am simulating MC-CDMA using Matlab. Here is the message Maltab
> returned when I ran the simulation:
>
> Undefined function or method 'snr' for input arguments of type 'char'.
> Error in ==> MCCDMA at 10
> snr _in_ dB = 0:1:15;
>
> I am using Matlab 2007b and the Matlab code is:
>
>
> % MCCDMA %
> % for simulation %
> %%%%%%%%%%%%%%%%%%%%
> %%% Transmitter Model %%%
> clear all;
> clc;close all;
> tic; % start a stopwatch timer
> xaxis=[];
> yaxis=[];
> snr _in_ dB = 0:1:15;
> R= 100;
> for n=1:lentgh(snr_in_dB)
> no_of_errors=0;
> for m=1:R
> N=8; %no of subchannels
> ifft_size=N; %ifft size
> fft_size=N; %fft size
> M=100000; % nos of data in each subchannel
> total_no_of_data= N*M;
> rand_data_seed=11;
> % Generation of N parallel dada sequence
> rand('seed',rand_data_seed);
> user_data_matrix=rand(N,M);
> user_data_matrix=(user_data_matrix>0.5)*2-1;
> % Calling of function for code matrix
> code_mat=code_matrix(N,'hada_11');
> trans_code_mat_out=(conj(code_mat))*user_data_matrix;
> % IFFT of the code matrix out
> trans_ifft_out=iff(trans_code_mat_out,ifft_size);
> % Normalization of IFFT
> trans_ifft_out_nor=trans_ifft_out* sqrt(N);
> % Parallel to serial of transmit signal
> trans_sig_serial=reshape(trans_ifft_out_nor,1,N*M);
> recv_sig_serial=trans_sig_serial;
> %%% Receiver Model %%%
> % Serial to parallel for received signal
> recv_signal_parallel=reshape(recv_signal_serial,N*M);
> % Taking FFT of the received signal(parallel)
> recv_fft_out=fft(recv_signal_parallel,fft_size);
> % Normalization of the FFT
> recv_fft_out_nor=recv_fft_out/sqrt(N);
> % Calling function for weight matrix
> [weight_mat,diag_h]=weight_mat(N,'awgn');
> % Multiplication of Rayleigh Noise with FFT out
> recv_fft_out_rayleigh=diag_h*recv_fft_out_nor;
> % Addition of AWGN
>
> recv_fft_awgn_out=awgn(recv_fft_out_rayleig,SNR_in_dB(n),'measured');
> recv_fft_out_noise=recv_fft_awgn_out-recv_fft_out_rayleigh;
> recv_fft_awgn_out=recv_fft_out_rayleigh+(recv_fft_out_noise/
> sqrt(2));
> % Multiplication by weight matrix
> recv_wmat_out=weight_mat*recv_fft_awgn_out;
> % Taking inverse of code matrix
> inv_code_mat=inv(code_mat);
> % Multiplication by Inverse Code Matrix
> out_data_parallel=inv_code_mat*(recv_wmat_out);
> % Taking real part of the out_data_ parallel matrix
> real_out_data_parallel=real(out_data_parallel);
> % Converting the real_out_parallel matrix to '1' and '-1'
> out_user_data_matrix=(real_out_data_parallel>0)*2-1;
> % Parallel to serial conversion of out data
> out_data_serial=reshape(out_user_data_matrix,1,N*M);
> %%% calculation of bit error rate %%%
> % regeneration of transmitted user data matrix
> rand('seed',rand_data_seed);
> trans_user_data_matrix=rand(N,M);
> trans_user_data_matrix=(trans_user_data_matrix>0.5)*2-1;
> % Calculation of bit error rate
>
> [no_of_errors,symbol_error_rate]=symerr(trans_user_data_matrix,out_user_data_matrix);
> no_of_errors=no_of_errors+no_of_errors;
> end;
> sym_err_rate=no_of_errors/total_no_of_data;
> ber_simulated=sym_err_rate/1.0;
> ber_simulated;
> yaxis=[yaxis,ber_simulated];
> end;
> xaxis=[xaxis,SNR_in_dB];
> % Save BER for different SNR
> save ybhawgns.mat yaxis;
> % Plotting command follows
> seminolog(xaxis,yyaxis,'g-');
> ylabel('.............SNR(dB).............');
> ylabel('.............AverageBER..........');
> axis([0 17 0.000001 0.1]);
> toc; % read the stop watchtimer,print time in second
> %%% End of program %%%
>
>
>
> Thanks for you help,take care!


send me the entire program including function program then only we can able to rectify the complete errors

Subject: MC-CDMA simulation using Matlab

From: saumya mohapatra

Date: 29 Sep, 2009 17:45:19

Message: 9 of 11

"lenin ram" <lenin_ram@rediffmail.com> wrote in message <gef862$lr4$1@fred.mathworks.com>...
> BULDO <mikailidirs@gmail.com> wrote in message <5452bf3f-bdde-41b0-97c6-25b5ee902e78@i29g2000prf.googlegroups.com>...
> > I am simulating MC-CDMA using Matlab. Here is the message Maltab
> > returned when I ran the simulation:
> >
> > Undefined function or method 'snr' for input arguments of type 'char'.
> > Error in ==> MCCDMA at 10
> > snr _in_ dB = 0:1:15;
> >
> > I am using Matlab 2007b and the Matlab code is:
> >
> >
> > % MCCDMA %
> > % for simulation %
> > %%%%%%%%%%%%%%%%%%%%
> > %%% Transmitter Model %%%
> > clear all;
> > clc;close all;
> > tic; % start a stopwatch timer
> > xaxis=[];
> > yaxis=[];
> > snr _in_ dB = 0:1:15;
> > R= 100;
> > for n=1:lentgh(snr_in_dB)
> > no_of_errors=0;
> > for m=1:R
> > N=8; %no of subchannels
> > ifft_size=N; %ifft size
> > fft_size=N; %fft size
> > M=100000; % nos of data in each subchannel
> > total_no_of_data= N*M;
> > rand_data_seed=11;
> > % Generation of N parallel dada sequence
> > rand('seed',rand_data_seed);
> > user_data_matrix=rand(N,M);
> > user_data_matrix=(user_data_matrix>0.5)*2-1;
> > % Calling of function for code matrix
> > code_mat=code_matrix(N,'hada_11');
> > trans_code_mat_out=(conj(code_mat))*user_data_matrix;
> > % IFFT of the code matrix out
> > trans_ifft_out=iff(trans_code_mat_out,ifft_size);
> > % Normalization of IFFT
> > trans_ifft_out_nor=trans_ifft_out* sqrt(N);
> > % Parallel to serial of transmit signal
> > trans_sig_serial=reshape(trans_ifft_out_nor,1,N*M);
> > recv_sig_serial=trans_sig_serial;
> > %%% Receiver Model %%%
> > % Serial to parallel for received signal
> > recv_signal_parallel=reshape(recv_signal_serial,N*M);
> > % Taking FFT of the received signal(parallel)
> > recv_fft_out=fft(recv_signal_parallel,fft_size);
> > % Normalization of the FFT
> > recv_fft_out_nor=recv_fft_out/sqrt(N);
> > % Calling function for weight matrix
> > [weight_mat,diag_h]=weight_mat(N,'awgn');
> > % Multiplication of Rayleigh Noise with FFT out
> > recv_fft_out_rayleigh=diag_h*recv_fft_out_nor;
> > % Addition of AWGN
> >
> > recv_fft_awgn_out=awgn(recv_fft_out_rayleig,SNR_in_dB(n),'measured');
> > recv_fft_out_noise=recv_fft_awgn_out-recv_fft_out_rayleigh;
> > recv_fft_awgn_out=recv_fft_out_rayleigh+(recv_fft_out_noise/
> > sqrt(2));
> > % Multiplication by weight matrix
> > recv_wmat_out=weight_mat*recv_fft_awgn_out;
> > % Taking inverse of code matrix
> > inv_code_mat=inv(code_mat);
> > % Multiplication by Inverse Code Matrix
> > out_data_parallel=inv_code_mat*(recv_wmat_out);
> > % Taking real part of the out_data_ parallel matrix
> > real_out_data_parallel=real(out_data_parallel);
> > % Converting the real_out_parallel matrix to '1' and '-1'
> > out_user_data_matrix=(real_out_data_parallel>0)*2-1;
> > % Parallel to serial conversion of out data
> > out_data_serial=reshape(out_user_data_matrix,1,N*M);
> > %%% calculation of bit error rate %%%
> > % regeneration of transmitted user data matrix
> > rand('seed',rand_data_seed);
> > trans_user_data_matrix=rand(N,M);
> > trans_user_data_matrix=(trans_user_data_matrix>0.5)*2-1;
> > % Calculation of bit error rate
> >
> > [no_of_errors,symbol_error_rate]=symerr(trans_user_data_matrix,out_user_data_matrix);
> > no_of_errors=no_of_errors+no_of_errors;
> > end;
> > sym_err_rate=no_of_errors/total_no_of_data;
> > ber_simulated=sym_err_rate/1.0;
> > ber_simulated;
> > yaxis=[yaxis,ber_simulated];
> > end;
> > xaxis=[xaxis,SNR_in_dB];
> > % Save BER for different SNR
> > save ybhawgns.mat yaxis;
> > % Plotting command follows
> > seminolog(xaxis,yyaxis,'g-');
> > ylabel('.............SNR(dB).............');
> > ylabel('.............AverageBER..........');
> > axis([0 17 0.000001 0.1]);
> > toc; % read the stop watchtimer,print time in second
> > %%% End of program %%%
> >if you will send the entire program like send the each function i will help you
i'm also doing research on 4G technology...

Subject: MC-CDMA simulation using Matlab

From: Montadar Taher

Date: 2 Nov, 2009 21:19:03

Message: 10 of 11

hi friends,

i need a very simple matlab program code for cdma as i am new to cdma programming.

please help me

Subject: MC-CDMA simulation using Matlab

From: deepak sheoran

Date: 17 Nov, 2009 09:24:01

Message: 11 of 11

"Montadar Taher" <muntather_moto@yahoo.com> wrote in message <hcnic7$r1v$1@fred.mathworks.com>...
> hi friends,
>
> i need a very simple matlab program code for cdma as i am new to cdma programming.
>
> please help me

even i also need the simple cdma code.
can anybody help me with this

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com