|
From: | majid Umar Ahmad |
Subject: | show me the steps plz |
Date: | Fri, 21 Jan 2011 03:49:49 +0000 |
I have this file which was written in octave 3.0.3 & was running just fine All the out put r ok but I format my pc & Lost the octave V3.0.3 So where can this program or how can I run this file in another version If I have to change the version of the software. Plz check out the source cods printf(“%s\n”,”Please Choose one the following Actions”) a=input(“1:Plot BER Vs S/N \n2:Plot ThroughPut Vs S/N \n3:Plot Transmission rate Vs Througthput\n4:quit\n”) switch a case {1,2} do m= input(“Please Enter the Transmission Rate [Mbps]\n”) until (m>0) m2=m*10^6; do printf(“%s\n”,”WiMAX standards packet sizes are: 128 bytes, 256 bytes and 512 bytes, Please select one of them”) p= input(“The selected packet size\n”) until (p>0) p=p*8; c= mod(m2,p); c=m2-c; Npacket=(c/p)+1; printf(“%s\n”,”To achieve the transmission rate of the chosen one”) printf(“%d%s\n”,Npacket, “packets must be sent”) sentbits=p*Npacket sentpackets=Npacket do c= input(“Please enter the number of iterations that you wish to reach a stable average\n”) until (c>0) printf(“%s\n”, “Please wait while operations are being processed”) average=0; average2=0; for k=1:1:c ip=rand(1,sentpackets)>0.5; s=2*ip-1; Eb=[-3:35]; for ii= 1:length(Eb) n= 1/sqrt(2)*[rand(1,sentpackets)+i*randn(1,sentpackets)]; h= 1/sqrt(2)*[rand(1,sentpackets)+i*randn(1,sentpackets)]; y=h.*s+10^(-Eb(ii)/20)*5*n; y2= s+10^(-Eb(ii)/20)*n; yHat=y/h; yHat2=y2; ipHat= real(yHat)>0; ipHat2= real(yHat2)>0; Err(ii)=size(find([ip- ipHat]),2); Err2(ii)=size(find([ip- ipHat2]),2); Throughput(ii)=(sentpackets-Err(ii)/sentpacket; Throughput2(ii)=(sentpackets-Err(ii)/sentpacket; end for ii=1:1:length(Eb) average=average+Throughput(ii); end m=length(Eb) average=average/m; average2=average2 + average; average3(k)=average2/k; end Throughput3=Through; n=1:1:k; plot(n,average3,’b-‘,’LineWidth’,2) xlabel(‘No.of Interation’); ylabel(‘Average Throughput’); title(‘Average Throughput Vs No. Of Itrations in Rayleigh channel’) pause for ii=2:1:k dev(ii)=average3(ii)-average3(ii-1); end dev(1)=0.1; t=1:1:k; plot(t,dev,’r-‘,’LineWidth’,2) xlabel(‘No.of Interation’); ylabel(‘Deviation’); title(‘Deviation Vs No. Of Iterations in Rayleigh channel’) Pause maxthr=Throughput3(1); minthr=Throughput3(1); for i=2:1:length(Eb) if Through3(i) > maxthr maxthr = Throughput3(i); else end end maxthr= maxthr*100; printf(“%s%f%s\n”,”The maximum throughput is:”,maxthr,”%”) for i=2:1:length(Eb) if Throughput3(i)<minthr minthr=Throughput3(i); else end end mainthr= mainthr*100; printf(“%s%f%s\n”,”The manimum throughput is:”,minthr,”%”) Pause Eb2=Err/sentpacket; Eb3=Err/sentpackets; Switch a case 1 EbN0Lin=10.^(Eb/10); theoryBer=0.5.*(1-sqrt(EbN0Lin./(EbN0Lin+1))); semilogy(Eb,theoryBer,’b-‘,’LineWidth’,2); hold on semilogy(Eb,Eb2,’m-‘,’LineWidth’,2); semilogy(Eb,Eb3,’r-‘,’LineWidth’,2); axis([-3 35 10^-5 0.5]) grid on legend(‘Rayleigh-Theory’,’Rayleigh-Simulation’,’Ideal Channel’); xlabel(‘Signal to Noise Ratio (S/N)’); ylabel(‘Bit Error Rate (BER)’); title(‘S/N Vs BER in Rayleigh channel’) Pause hold off case 2 plot(Eb,Throughput,’b-‘, ‘LineWidth’,2) hold on plot(Eb,Throughput2,’r-‘, ‘LineWidth’,2) grid on legend(‘Fading Channel’, ‘Ideal Channel’) xlable(‘Signal to Noise Ratio (S/N)’); ylable(‘Throughput’); tittle(‘Throughput Vs S/N in Rayleigh channel’) Pause hold off endswitch switch a case 1 Published= [0.52 0.52 0.51 0.5 0.49 0.48 0.47 0.46 0.45 0.4 0.35 0.3 0.26 0.2 0.17 0.12 0.09 0.075 0.06 0.045 0.032 0.02 0.015 0.013 0.01 0.009 0.0085 0.008 0.007 0.006 0.005 0.0037 0.0035 0.003 0.0028 0.0026 0.0024 0.0022 0.002]; semilogy(Eb,Eb2,’b-‘,‘Linewidth’,2); hold on semilogy(Eb,published,’r-‘,‘Linewidth’,2) axis([-3 35 10^-5 0.5]) grid on legend(‘Rayleigh-Simulation’,’Published Results’) xlabel(‘Signal to Noise Ratio (S/N)’); ylabel(‘Bit Error Rate (BER)’); title(‘S/N Vs BER in Rayleigh channel’) pause hold off case 2 Published=[0.607 0.61 0.616 0.625 0.639 0.65 0.672 0.69 0.707 0.72 0.74 0.76 0.785 0.81 0.85 0.87 0.89 0.907 0.92 0.928 0.935 0.95 0.957 0.96 0.967 0.97 0.973 0.976 0.978 0.98 0.982 0.985 0.988 0.99 0.992 0.995 0.997 0.999]; plot(Eb,Throughput,’b-’,’LineWidth’,2) hold on plot(Eb,published,’r-‘,‘LineWidth’,2) grid on legend(‘Fading Channel’,‘Published Results’) xlabel(Signal to Noise Ratio (S/N)’); ylable(‘Throughput’); title(‘Throughput Vs S/N in Rayleigh channel’) pause hould off endswith case 3 printf(“%s\n”,”please Enter the range of the transmission rates to plot the Throughput\n”) b=input(“The Minimum Limit:\n”) e=input(“The Maximum Limit:\n”) b=b*10^6; e=e*10^6; do printf(“%s\n”,“WiMAX standards packet sizes are: 128 bytes, 256 bytes and 512 bytes, Please select one of them”) p= input(“The selected packet size\n”) until (p>0) p=p*8; printf(“%s\n”,“The Signal to(S/N) is choosed to be 5dB”) b2=mod(b,p); e2=mod(e,p); b=b-b2; e=e-e2; Lpacket=(b/p)+1; Hpacket=(e/p)+1; sentb=p*Lpacket; sente=p*Hpecket bwl=b; bw2=e; stepbw=(bw2-bwl)/30; stepsig=(e-b)/30; Eb=5; bw3=bwl; do c=input(“Please enter the number of iterations that you wish to reach a stable average\n”) until (c>0) printf(“%s\n”,“Please wait while operation are being processed”) average=0; for k=1:1:c for ii=1:1:30 sig=rand(1,sentb)>0.5; sig2=2*sig-1; n=1/sqrt(2)*[randn(1,sentb)+i*randn(1,sentb)]; h=1/ sqrt(2)*[randn(1,sentb)+i*randn(1,sentb)]; y=h.*sig2+10^(-Eb/20)*5*n; yHat=y./h; ipHat=real(yHat)>0; Err=size(find([sig-ipHat]),2); Throughput(ii)=(sentb-Err)/sentb; sentb=sentb+stepsig; bandwidth(ii)=bw3; bw3=bw3+stepbw; end bandwidth=bandwidth/10^6; end plot(bandwidth,Throughput) xlable(‘Transmission rate (Mbps)’); ylable(‘Throughput’); : title(‘Transmission Rate Vs Througthput in Rayleigh channel’) Pause case 4 quit otherwise printf(“%s\n”,“The number You entered is wrong, please choose again\n”) endswitch until (a= =4) |
[Prev in Thread] | Current Thread | [Next in Thread] |