|
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 -
|