Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab help error : Undefined function or method 'rcpulse' for input arguments of typ

  1. Mar 21, 2012 #1
    here is my matlab code of SCFDMA i am getting error at line "psFilter = rcpulse(Ts, Nos,rolloffFactor);" error is Undefined function or method 'rcpulse' for input arguments of type 'double'": function paprSCFDMA()

    dataType = 'Q-PSK'; % Modulation format.

    totalSubcarriers = 256; % Number of total subcarriers.

    numSymbols = 64; % Data block size.

    Q = totalSubcarriers/numSymbols; % Bandwidth spreading factor of IFDMA.

    Q_tilda =3 ; % Bandwidth spreading factor of DFDMA. Q_tilda < Q.

    subcarrierMapping = 'IFDMA'; % Subcarrier mapping scheme.

    pulseShaping = 1; % Whether to do pulse shaping or not.

    filterType = 'rc'; % Type of pulse shaping filter.

    rolloffFactor = 0.5; %Rolloff factor for the raised-cosine filter. %To prevent divide-by-zero, for example, use 0.099999999 instead of 0.1. Fs = 5e6; % System bandwidth.

    Ts = 1/Fs; % System sampling rate.

    Nos = 4; % Oversampling factor.

    if filterType == 'rc' % Raised-cosine filter.

    psFilter = rcpulse(Ts, Nos,rolloffFactor);

    elseif filterType == 'rr' % Root raised-cosine filter.

    psFilter = rrcPulse(Ts, Nos, rolloffFactor);
    end

    numRuns = 1e4; % Number of iterations.

    papr = zeros(1,numRuns); % Initialize the PAPR results.

    for n = 1:numRuns,

    % Generate random data.
    if dataType == 'Q-PSK'
    tmp = round(rand(numSymbols,2));
    tmp = tmp*2 - 1;
    data = (tmp(:,1) + j*tmp(:,2))/sqrt(2);
    elseif dataType == '16QAM'
    dataSet = [-3+3i -1+3i 1+3i 3+3i ...
    -3+i -1+i 1+i 3+i ...
    -3-i -1-i 1-i 3-i ...
    -3-3i -1-3i 1-3i 3-3i];
    dataSet = dataSet / sqrt(mean(abs(dataSet).^2));
    tmp = ceil(rand(numSymbols,1)*16);
    for k = 1:numSymbols,
    if tmp(k) == 0
    tmp(k) = 1;
    end
    data(k) = dataSet(tmp(k));
    end
    data = data.';
    end
    % Convert data to frequency domain.
    X = fft(data);
    % Initialize the subcarriers.
    Y = zeros(totalSubcarriers,1);
    % Subcarrier mapping.
    if subcarrierMapping == 'IFDMA'
    Y(1:Q:totalSubcarriers) = X;
    elseif subcarrierMapping == 'LFDMA'
    Y(1:numSymbols) = X;
    elseif subcarrierMapping == 'DFDMA'
    Y(1:Q_tilda:Q_tilda*numSymbols) = X;
    end
    % Convert data back to time domain.
    y = ifft(Y);
    % Perform pulse shaping.
    if pulseShaping == 1
    % Up-sample the symbols.
    y_oversampled(1:Nos:Nos*totalSubcarriers) = y;
    % Perform filtering.
    y_result = filter(psFilter, 1, y_oversampled);
    else
    y_result = y;
    end
    % Calculate the PAPR.
    % papr(n) = 10*log10(max(abs(y_result).^2) / mean(abs(y_result).^2));
    end

    % Plot CCDF.

    [N,X] = hist(papr, 100);

    semilogy(X,1-cumsum(N)/max(cumsum(N)),'b')

    % Save data.

    save paprSCFDMA
     
  2. jcsd
  3. Mar 21, 2012 #2

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    Re: matlab help error : Undefined function or method 'rcpulse' for input arguments of

    do you have a function defined as rcpulse.m???
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matlab help error : Undefined function or method 'rcpulse' for input arguments of typ
Loading...