please i have a question in matlab can any one help me please i want to correct this code ? i dont understand the error
Info
This question is closed. Reopen it to edit or answer.
Show older comments
N=32;
t=100;
R=1000;
c=[];
nprime=50;
for n=1:t
for u=1:R
% c=perform_read_cycle(N,c);
c=(1-(1-(1/N)).^t )*(1+(n/(N-1)));
% n(u)=estimate_tags(N,c);
n(u)=rand(1,1000);
e(u)= rand (1,100);
e(u)=n(u)-nprime;
end
% u(n')=n(u)-n';
% u=mean(eu,R);
end
plot(e(u),t);
4 Comments
Guillaume
on 20 Jul 2015
You haven't even asked a question. Just posted some code (which I had to format for you).
safi marwa
on 20 Jul 2015
Jan
on 20 Jul 2015
You claim that your question is "urgent" but do not ask a question? You want the readers to explain the error of your code but do not take the time to explain, why you assume that there is an error? This is a bad strategy to get help and another example for questions, which contain the term "urgent", but do not provide even enough information to be answered efficiently.
safi marwa
on 20 Jul 2015
Answers (1)
Torsten
on 20 Jul 2015
0 votes
e(u) is the u-the element of the vector e, thus a single number. In the command
e(u)= rand (1,100);
you try to assign a vector with 100 elements to this single number. This is not possible.
(Same for n(u)).
Best wishes
Torsten.
7 Comments
safi marwa
on 20 Jul 2015
Guillaume
on 20 Jul 2015
Another issue is that you (try to) assign a value to the variable n which is also a loop variable. Either the loop variable or the destination needs to change name.
Image Analyst
on 20 Jul 2015
Replace these lines:
n(u)=rand(1,1000);
e(u)= rand (1,100);
e(u)=n(u)-nprime;
with this:
e(u)= rand(1) - nprime;
safi marwa
on 20 Jul 2015
Edited: Walter Roberson
on 20 Jul 2015
Walter Roberson
on 20 Jul 2015
plot(e)
safi marwa
on 20 Jul 2015
Walter Roberson
on 20 Jul 2015
rand(1) means to create a 1 x 1 array of uniformly distributed random numbers in the range 2^(-53) to (1-2^(-53)) inclusive (that is, (0,1) exclusive)
This question is closed.
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!