تصحيح برنامج

بسم الله الرحمن الرحيم

السلام عليكم ورحمة الله وبركاته.
البرنامج التالي هو من الـ Help للماتلاب تحت عنوان Comparing Theoretical and Empirical Error Rates ويعمل بشكل طبيعي :-

% Comparing Theoretical and Empirical Error Rates

%

% The example below uses the berawgn function to compute symbol error rates for pulse amplitude modulation (PAM) with a series of Eb/N0 values. For comparison, the code simulates 8-PAM with an AWGN channel and computes empirical symbol error rates. The code also plots the theoretical and empirical symbol error rates on the same set of axes.

%

% 1. Compute theoretical error rate using BERAWGN.

M = 8; EbNo = [0:13];

[ber, ser] = berawgn(EbNo,‘pam’,M);

% Plot theoretical results.

figure; semilogy(EbNo,ser,‘r’);

xlabel(‘E_b/N_0 (dB)’); ylabel(‘Symbol Error Rate’);

grid on; drawnow;

% 2. Compute empirical error rate by simulating.

% Set up.

n = 10000; % Number of symbols to process

k = log2(M); % Number of bits per symbol

% Convert from EbNo to SNR.

% Note: Because No = 2*noiseVariance^2, we must add 3 dB

% to get SNR. For details, see Proakis book listed in

% “Selected Bibliography for Performance Evaluation.”

snr = EbNo+3+10*log10(k);

ynoisy=zeros(n,length(snr)); % Preallocate to save time.

% Main steps in the simulation

x = randint(n,1,M); % Create message signal.

y = pammod(x,M); % Modulate.

% Send modulated signal through AWGN channel.

% Loop over different SNR values.

for jj = 1:length(snr)

ynoisy(:,jj) = awgn(real(y),snr(jj),‘measured’);

end

z = pamdemod(ynoisy,M); % Demodulate.

% Compute symbol error rate from simulation.

[num,rt] = symerr(x,z);

% 3. Plot empirical results, in same figure.

hold on; semilogy(EbNo,rt,‘b.’);

legend(‘Theoretical SER’,‘Empirical SER’);

title(‘Comparing Theoretical and Empirical Error Rates’);

hold off;

[RIGHT]

[RIGHT]

لكن أريد أن أحول البرنامج من 8-PAM ليعمل على 16QAM ولم أفلح بذلك حيث أن البرنامج الذي استخدمته هو:-

% Comparing Theoretical and Empirical Error Rates

%

% The example below uses the berawgn function to compute symbol error rates for pulse amplitude modulation (PAM) with a series of Eb/N0 values. For comparison, the code simulates 8-PAM with an AWGN channel and computes empirical symbol error rates. The code also plots the theoretical and empirical symbol error rates on the same set of axes.

%

% 1. Compute theoretical error rate using BERAWGN.

M = 16; EbNo = [0:13];

[ber, ser] = berawgn(EbNo,‘qam’,M);

% Plot theoretical results.

figure; semilogy(EbNo,ser,‘r’);

xlabel(‘E_b/N_0 (dB)’); ylabel(‘Symbol Error Rate’);

grid on; drawnow;

% 2. Compute empirical error rate by simulating.

% Set up.

n = 10000; % Number of symbols to process

k = log2(M); % Number of bits per symbol

% Convert from EbNo to SNR.

% Note: Because No = 2*noiseVariance^2, we must add 3 dB

% to get SNR. For details, see Proakis book listed in

% “Selected Bibliography for Performance Evaluation.”

snr = EbNo+3+10*log10(k);

ynoisy=zeros(n,length(snr)); % Preallocate to save time.

% Main steps in the simulation

x = randint(n,1,M); % Create message signal.

y = qammod(x,M); % Modulate.

% Send modulated signal through AWGN channel.

% Loop over different SNR values.

for jj = 1:length(snr)

ynoisy(:,jj) = awgn(real(y),snr(jj),‘measured’);

end

z = qamdemod(ynoisy,M); % Demodulate.

% Compute symbol error rate from simulation.

[num,rt] = symerr(x,z);

% 3. Plot empirical results, in same figure.

hold on; semilogy(EbNo,rt,‘b.’);

legend(‘Theoretical SER’,‘Empirical SER’);

title(‘Comparing Theoretical and Empirical Error Rates 16QAM’);

hold off;




أرجو المساعدة لتصحيح البرنامج ليعمل على 16QAM وبصورة عامة على MQAM
يبدو أن الرسمين لم يظهرا في الصفحة. لايهم
وبارك الله فيكم وجزاكم خيرا.

أخي لازم ترفع الصور على أي سرفر متل
ihttp://imageshack.us/
متلا وتضع الرابط في الموضوع ، ون شاء الله نحاول المساعدة حسب الإستطاعة

بسم الله الرحمن الرحيم

السلام عليكم ورحمة الله وبركاته.
ارفق طياً الموضوع على صيغة Microsoft Word 2007 أرجو ان يفي بالغرض . شكرا.

[CENTER]أخي شوف حدة الكود


% symbol error rate for 16-QAM modulation

% symbol error rate for 16-QAM modulation
clear
N = 2*10^5; % number of symbols
alpha16qam = [-3 -1 1 3]; % 16-QAM alphabets
Es_N0_dB = [0:20]; % multiple Es/N0 values
ipHat = zeros(1,N);
for ii = 1:length(Es_N0_dB)
    ip = randsrc(1,N,alpha16qam) + j*randsrc(1,N,alpha16qam);
    s = (1/sqrt(10))*ip; % normalization of energy to 1
    n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white guassian noise, 0dB variance

    y = s + 10^(-Es_N0_dB(ii)/20)*n; % additive white gaussian noise

    % demodulation
    y_re = real(y); % real part
    y_im = imag(y); % imaginary part

    ipHat_re(find(y_re< -2/sqrt(10)))           = -3;
    ipHat_re(find(y_re > 2/sqrt(10)))           =  3;
    ipHat_re(find(y_re>-2/sqrt(10) & y_re<=0))  = -1;
    ipHat_re(find(y_re>0 & y_re<=2/sqrt(10)))   =  1;

    ipHat_im(find(y_im< -2/sqrt(10)))           = -3;
    ipHat_im(find(y_im > 2/sqrt(10)))           =  3;
    ipHat_im(find(y_im>-2/sqrt(10) & y_im<=0))  = -1;
    ipHat_im(find(y_im>0 & y_im<=2/sqrt(10)))   =  1;
    ipHat = ipHat_re + j*ipHat_im;
    nErr(ii) = size(find([ip- ipHat]),2); % couting the number of errors
end

simBer = nErr/N;
theoryBer = 3/2*erfc(sqrt(0.1*(10.^(Es_N0_dB/10))));
close all
figure
semilogy(Es_N0_dB,theoryBer,'b.-','LineWidth',2);
hold on
semilogy(Es_N0_dB,simBer,'mx-','Linewidth',2);
axis([0 20 10^-5 1])
grid on
legend('theory', 'simulation');
xlabel('Es/No, dB')
ylabel('Symbol Error Rate')
title('Symbol error probability curve for 16-QAM modulation') 


[/center]

[CENTER]بسم الله الرحمن الرحيم

[/center]
السلام عليكم ورحمة الله وبركاته.
اشتغل البرنامج بصورة ممتازة.بارك الله في جهودكم وجعلها في ميزان حسناتكم.
أرجو قراءة المرفق. شكراً.

[CENTER]بسم الله الرحمن الرحيم

[/center]
السلام عليكم ورحمة الله وبركاته.
بعد هذا المجهود الطيب اريد تطبيق البرنامج على 4QAM, 64QAM,256QAM أيضاً, فهل من مساعدة ودائما ممنون لكم.

أخي العزيز tasktask كان البرنامج الذي ارسلته ممتاز فيما يخص 16QAM . عند كتابة البرنامج ليكون عاما لجميع قيم M أي لـ MQAM , أرجو المساعدة في ذلك.
جزاك الله خيراً أيها الغالي.


[CENTER]أسف أخي على التأخير لكن مش بإرادتي [SIZE=4]

[/size]شوف هدا الرابط ورد علي ، وأن شاء الله خير [SIZE=4]

[/size][FONT=Georgia][SIZE=4][COLOR=Navy]http://www.mathworks.com/help/toolbox/comm/ref/semianalytic.html[/color][/size][/font]
[/center]

ـالسلام عليكم ورحمة الله وبركاته
اشكرك جدا على اهتمامك وردك.
الرابط الذي ارسلته هو استخدام الـ
semianalytic technique في الـ Communications Toolbox والذي نريده هو simulation باستخدام البرنامج الـمباشر (مثل الذي ارسلته لي المرة الأولى)
[SIZE=4]أردت برنامج مكتوب عام يخص كل الـ M

قمت انا بمحاولة التعويض في برنامج 16QAM لاستخدامه في 4QAM , اشتغل البرنامج وأعتقد أن هناك خطأ في بعض المعاملات التي لم يتم تعديلها, لذلك الشكل الناتج لايفرق كثير عن الرسم لـ 16QAM[/size]
ارسل المرفق فيه البرنامج الأولي لـ 16QAMوالبرنامج المعدل لـ 4QAM المطلوب ضبطه.
وبارك الله فيك أخي العزيز وأعلم أن الـ communication ليس اختصاصك وأشكرك على صبرك معي.


[CENTER]أسف أخي الكريم لأني لم انتبه للفرق ، وأن شاء الله أنا ححاول اساعد حتى نصل الى النتيجة المطلوبة . مافي أي مشكل أخي الغالي الحمد لله احنا هنا حتى نساعد بعضنا البعض ، ون شاء الله أنا أحاول أجد لك الحل المطلوب .

تحياتي
[/center]

لك مني ألف شكر وفقك الله.

السلام عليكم ورحمة الله وبركاته
أخي العزيز: بفضل الله عثرت على البرنامج(الكود) المطلوب من النت أرسله لك مع الرابط وهو يعمل على كل انواع M فقط المطلوب تعويض قيمة
M في البداية 4,16,64,256,1024 ويعطيك النتيجة مباشرة لكل منها.
أشكرك كثيرا وبارك الله في جهودك ونقفل الموضوع حاليا.
وبالتوفيق.

[CENTER][FONT=Georgia][SIZE=4][COLOR=Navy]الحمد لله أخي ، وأن شاء الله تدرجه لنا حتى نستفيد منه أيضا وتعم الفائدة

وبالتوفيق أخي الكريم [/color][/size][/font]
[/center]

السلام عليكم ورحمة الله وبركاته
أرسل المرفق وفيه الرابط مع الأشكال.
لكنني في تساؤل عن التطابق التام بين الـ(Theory & Simulation) في الرسم, هل الكود مضبوط؟
لك مني ألف شكر.
و ياريت ياريت أحصل على الكود 16QAM الذي ارسلته يوم 6/2/2011 واشتغل مضبوط ولكن أريده عام يشمل جميع قيم M
تمنياتي بالتوفيق.

المرفق