Help with recursion limit!

Help! When I run my code on my laptop it runs without error, but when I run it from an old computer it throws me the error:
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your available stack space can crash MATLAB and/or your computer. Error in coder.allowpcode
and I need to run my code from the old computer. I set also the recursion limit to a bigger value, but my matlab program crash, and I just try until de maximum value in order that matlab do not crash ans also gives me that error. Can somebody help me, I don't understand why is this.
My code is:
function hLMChan= nume(Ts,Fd,pathDelays,avgPathGains)
hLMChan = rayleighchan(Ts,Fd,pathDelays,avgPathGains); hLMChan.StoreHistory=1;
M = 2; % Modulation order
hMod = comm.BPSKModulator(0);
Rsym = 1200; % Input symbol rate
Rbit = Rsym * log2(M); % Input bit rate
Nos = 2; % Oversampling factor
Ts = (1/Rbit) / Nos; % Input sample period
Fd = 1; % Chosen maximum Doppler shift for simulation
pathDelays = [0 0.002];
avgPathGains = [0 0]; N = 10000;
Nsamples = 100; %number of samples per frame
dop = doppler.gaussian;
hLMChan.DopplerSpectrum = dop;
plot(hLMChan);
for frames = 1:N
inputSig = step(hMod, randi([0 M-1], Nsamples, 1)); % Apply the channel effects % Channel filter %run signal through channel
end
end

6 Comments

Stephen23
Stephen23 on 18 May 2015
Edited: Stephen23 on 18 May 2015
Please format your code by selecting it and then clicking the {} Code button that you will find just above the textbox. Unformatted code is practically unreadable.
Jan
Jan on 18 May 2015
Please post the complete error message. Which function causes the recursion? Currently we see only the function "nume", but the code does not contain a recursive call.
function hLMChan= nume(Ts,Fd,pathDelays,avgPathGains)
hLMChan = rayleighchan(Ts,Fd,pathDelays,avgPathGains); hLMChan.StoreHistory=1;
M = 2; % Modulation order
hMod = comm.BPSKModulator(0);
Rsym = 1200; % Input symbol rate
Rbit = Rsym * log2(M); % Input bit rate
Nos = 2; % Oversampling factor
Ts = (1/Rbit) / Nos; % Input sample period
Fd = 1; % Chosen maximum Doppler shift for simulation
pathDelays = [0 0.002];
avgPathGains = [0 0]; N = 10000;
Nsamples = 100; %number of samples per frame
dop = doppler.gaussian;
hLMChan.DopplerSpectrum = dop;
plot(hLMChan);
for frames = 1:N
inputSig = step(hMod, randi([0 M-1], Nsamples, 1)); % Apply the channel effects % Channel filter %run signal through channel
end
end
Thanks a lot for answering to me,I manage to solve the problem.Now,I'm facing with an error for weeks.I;m using the AWR-vss program,and I use the MATLAB block to simulate a channel using matlab code.But when I run the whole project it gives me an error: Failed to read matlab mattrix out.Nobody answers to me on NI forums,and I don't know what to do anymore and the time is pressing me.I will be very grateful if somebody could help me.
Stephen23
Stephen23 on 4 Jun 2015
Edited: Stephen23 on 4 Jun 2015
We would be happy to help you, but you need to give us the exact information that we ask for: instead you just gave us another copy of the code that you already gave in your question.
Please give the complete and whole error message, and explain/show where this recursive call is happening.
Stephen the original problem was solved somehow and the new question is wildly different
Thanks a lot for your interest in helping me, now,I think I solved also the second problem. When I run the code it functions,the graph(power spectrum) appears,but the simulation time is very long,the simulation never ends unless I stop it. Does anybody knows how could i decrease the simulation time.I repeat,i'm working in AWR-VSS program and i'm using the matlab block.

Sign in to comment.

Answers (0)

Asked:

on 18 May 2015

Commented:

on 5 Jun 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!