Image encoding...pls help...
Info
This question is closed. Reopen it to edit or answer.
Show older comments
I have to find the probability of error(i.e probability vs Eb/N0 graph) for (7,4) linear ,cyclic, and convolution code and compare it to get the best technique...pls help...
I have the code for (7,4)linear code as under and it is working fine...cant get help for the other two....
clc; clear all; close all; a=input('Enter the block code(n,k);'); %input from user n=a(1,1); k=a(1,2); m=n-k; i=1; for j=5:25; x=sqrt(2*j); q=0.5*erfc(sqrt(j)); p(1,i)=k*q; i=i+1; end semilogy(p,'s-','LineWidth',2);hold on; hm=2^m; sum=0; for t=0:50; if(sum>hm) sum=sum-n1; break; end n1=factorial(n)/(factorial(n-t)*factorial(t)); sum=sum+n1; end t=t-2; fprintf('It can correct upto %d error(s)',t) i=1; for ratio =5:25; x1=sqrt(2*k*ratio/n); ncr=[factorial(n)/factorial(n-(t+1))*factorial(t+1)]; %calculates ncr pec(1,i)=((erfc(x1/sqrt(2))/2)^(t+1))*ncr; %calculates probability of error i=i+1; end semilogy(pec,'r*-','LineWidth',2); title('Probability vs Eb/N0 for coded and uncoded data'); xlabel('Eb/N0, dB'); ylabel('Probability ');
2 Comments
Image Analyst
on 4 Apr 2013
Edit your post, highlight your code, click the {}Code icon. http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Please omit the brute clearing header "clc; clear all; close all;". 1. this wastes a lot of time, because "clear all" removes all loaded functions from the memory also and reloading them from the slow disk and parsing them is demanding. 2. "clear all" removes all breakpoints in the code. A standard procedure, which prevents debugging conceptionally, is a really bad idea. 3. The argument, that teachers suggest it or many other people use this also, does not count: Even the majority of programmers can have bad programming methods.
I do not understand the question. Do you have problems with the posted code, if so, which one? If not, why did you post it?
Using "sum" as a name of a variable leads to problems frequently, because this shadows the built-in command with the same name.
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!