www.gusucode.com > matlab编程psk调制解调的gui实现通信系统的仿真源码程序 > matlab编程psk调制解调的gui实现通信系统的仿真源码程序/PSK_GUI/PSK_GUI.m

    function varargout = PSK_GUI(varargin)
% PSK_GUI M-file for PSK_GUI.fig
%      PSK_GUI, by itself, creates a new PSK_GUI or raises the existing
%      singleton*.
%
%      H = PSK_GUI returns the handle to a new PSK_GUI or the handle to
%      the existing singleton*.
%
%      PSK_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in PSK_GUI.M with the given input arguments.
%
%      PSK_GUI('Property','Value',...) creates a new PSK_GUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before PSK_GUI_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to PSK_GUI_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help PSK_GUI

% Last Modified by GUIDE v2.5 25-Jun-2008 14:03:58

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @PSK_GUI_OpeningFcn, ...
    'gui_OutputFcn',  @PSK_GUI_OutputFcn, ...
    'gui_LayoutFcn',  [] , ...
    'gui_Callback',   []);
if nargin & isstr(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before PSK_GUI is made visible.
function PSK_GUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to PSK_GUI (see VARARGIN)

% Choose default command line output for PSK_GUI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes PSK_GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = PSK_GUI_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
fp=get(handles.edit2,'string');
dB_min=str2num(fp);
fp=get(handles.edit3,'string');
dB_max=str2num(fp);
fp=get(handles.edit4,'string');
dB_aml1=str2num(fp);
fp=get(handles.edit5,'string');
dB_aml2=str2num(fp);

snr_in_dB=dB_min:2.00:dB_max;
snr_in_dB2=dB_min:0.1:dB_max;
M=16;
for i=1:length(snr_in_dB)
    [erro_bit_pro(i),erro_pro(i)]=m_psk2(handles,snr_in_dB(i),M);
end
for i=1:length(snr_in_dB2)
    snr=10^(snr_in_dB2(i)/10);
    erro_theo(i)=erfc(sqrt(snr)*sin(pi/M));%理论误码率
end
nn=2;   %拟合阶数
erro_bit_cc=polyfit(snr_in_dB,erro_bit_pro,nn);
erro_bit_c=polyval(erro_bit_cc,snr_in_dB2);   %误信率拟合

erro_cc=polyfit(snr_in_dB,erro_pro,nn);
erro_c=polyval(erro_cc,snr_in_dB2); %误码率拟合
txt(1,:)=['实验误码率  ',num2str(erro_pro)];
axes(handles.axes1)
reset(handles.axes1)
semilogy(snr_in_dB,erro_pro,'*');
hold
semilogy(snr_in_dB,erro_bit_pro,'o');
semilogy(snr_in_dB2,erro_theo);
plot(snr_in_dB2,erro_c,'r-')
plot(snr_in_dB2,erro_bit_c,'y-')
axis([dB_min,dB_max,dB_aml2,dB_aml1])
xlabel('信噪比S/N');
ylabel('误码率')
legend('误码率','误信率','理论误码率','误码率拟合曲线','误信率拟合曲线',3)
title('16-PSK仿真(matlab函数)与理论误码率比较')
%%%


snr_in_dB=dB_min:2:dB_max;
snr_in=dB_min:0.1:dB_max;
for i=1:length(snr_in_dB)
    [bt,bs]=psk_m(snr_in_dB(i));
    erro_bit(i)=bt;
    erro_prd(i)=bs;
end

for i=1:length(snr_in)
    SNR=10^(snr_in(i)/10);%信噪比转换
    %thro_snr(i)=exp(-SNR*(sin(pi/M)*sin(pi/M)));%理论信噪比
    thro_snr(i)=erfc(sqrt(SNR)*sin(pi/M));%理论误码率
end

nn=2;   %拟合阶数
erro_bit_cc=polyfit(snr_in_dB,erro_bit,nn);
erro_bit_c=polyval(erro_bit_cc,snr_in);   %误信率拟合

erro_cc=polyfit(snr_in_dB,erro_prd,nn);
erro_c=polyval(erro_cc,snr_in); %误码率拟合

axes(handles.axes2)
reset(handles.axes2)
semilogy(snr_in_dB,erro_bit,'*');
hold
semilogy(snr_in_dB,erro_prd,'o');
semilogy(snr_in,thro_snr);
plot(snr_in,erro_bit_c,'r-')
plot(snr_in,erro_c,'y-')
xlabel('信噪比S/N');
ylabel('误码率')
legend('误码率','误信率','理论误码率','误码率拟合曲线','误信率拟合曲线',3)
title('16-PSK仿真与理论误码率比较')
axis([dB_min,dB_max,dB_aml2,dB_aml1])
txt(2,:)=['实验误码率  ',num2str(erro_bit)];
%txt(3,:)=['实验信噪比  ',num2str(double([0.00:2.00:20.00]))];
set(handles.edit1,'string',txt)
%set(handles.edit1(2),'string',txt)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [bt,bs]=psk_m(snr_in_dB)
%输入信号噪声功率比是snr_in_dB
%bt  输出仿真比特
%bs  输出仿真误码率
N=100;
snr=10^(snr_in_dB/10);%信噪比转换
sgma=4*sqrt(1/(2*snr));
%sgma=M*sqrt(1/(2*SNR));
%信号映射,采用 pi/M 系统
s0000=[0 0 0 0];
s0001=[0 0 0 1];
s0010=[0 0 1 0];
s0011=[0 0 1 1];
s0100=[0 1 0 0];
s0101=[0 1 0 1];
s0110=[0 1 1 0];
s0111=[0 1 1 1];
s1000=[1 0 0 0];
s1001=[1 0 0 1];
s1010=[1 0 1 0];
s1011=[1 0 1 1];
s1100=[1 1 0 0];
s1101=[1 1 0 1];
s1110=[1 1 1 0];
s1111=[1 1 1 1];
%产生数据源
for i=1:N
    temp=rand;
    if(temp<0.0625)
        d_source1(i)=0;
        d_source2(i)=0;
        d_source3(i)=0;
        d_source4(i)=0;
    elseif(temp<0.125)
        d_source1(i)=0;
        d_source2(i)=0;
        d_source3(i)=0;
        d_source4(i)=1;
    elseif(temp<0.1875)
        d_source1(i)=0;
        d_source2(i)=0;
        d_source3(i)=1;
        d_source4(i)=0;
    elseif(temp<0.25)
        d_source1(i)=0;
        d_source2(i)=0;
        d_source3(i)=1;
        d_source4(i)=1;
    elseif(temp<0.3125)
        d_source1(i)=0;
        d_source2(i)=1;
        d_source3(i)=0;
        d_source4(i)=0;
    elseif(temp<0.375)
        d_source1(i)=0;
        d_source2(i)=1;
        d_source3(i)=0;
        d_source4(i)=1;
    elseif(temp<0.4375)
        d_source1(i)=0;
        d_source2(i)=1;
        d_source3(i)=1;
        d_source4(i)=0;
    elseif(temp<0.5)
        d_source1(i)=0;
        d_source2(i)=1;
        d_source3(i)=1;
        d_source4(i)=1;
    elseif(temp<0.5625)
        d_source1(i)=1;
        d_source2(i)=0;
        d_source3(i)=0;
        d_source4(i)=0;
    elseif(temp<0.625)
        d_source1(i)=1;
        d_source2(i)=0;
        d_source3(i)=0;
        d_source4(i)=1;
    elseif(temp<0.6875)
        d_source1(i)=1;
        d_source2(i)=0;
        d_source3(i)=1;
        d_source4(i)=0;
    elseif(temp<0.75)
        d_source1(i)=1;
        d_source2(i)=0;
        d_source3(i)=1;
        d_source4(i)=1;
    elseif(temp<0.8125)
        d_source1(i)=1;
        d_source2(i)=1;
        d_source3(i)=0;
        d_source4(i)=0;
    elseif(temp<0.875)
        d_source1(i)=1;
        d_source2(i)=1;
        d_source3(i)=0;
        d_source4(i)=1;
    elseif(temp<0.9375)
        d_source1(i)=1;
        d_source2(i)=1;
        d_source3(i)=1;
        d_source4(i)=0;
    else
        d_source1(i)=1;
        d_source2(i)=1;
        d_source3(i)=1;
        d_source4(i)=1;
    end
end
num_erro=0;
num_bit=0;
%产生高斯噪声
for i=1:N
    [n(1),n(2),n(3),n(4)]=gngauss(sgma);
    %相干解调
    if(d_source1(i)==0)&(d_source2(i)==0)&(d_source3(i)==0)&(d_source4(i)==0)
        r=s0000+n;
    elseif(d_source1(i)==0)&(d_source2(i)==0)&(d_source3(i)==0)&(d_source4(i)==1)
        r=s0001+n;
    elseif(d_source1(i)==0)&(d_source2(i)==0)&(d_source3(i)==1)&(d_source4(i)==0)
        r=s0010+n;
    elseif(d_source1(i)==0)&(d_source2(i)==0)&(d_source3(i)==1)&(d_source4(i)==1)
        r=s0011+n;
    elseif(d_source1(i)==0)&(d_source2(i)==1)&(d_source3(i)==0)&(d_source4(i)==0)
        r=s0100+n;
    elseif(d_source1(i)==0)&(d_source2(i)==1)&(d_source3(i)==0)&(d_source4(i)==1)
        r=s0101+n;
    elseif(d_source1(i)==0)&(d_source2(i)==1)&(d_source3(i)==1)&(d_source4(i)==0)
        r=s0110+n;
    elseif(d_source1(i)==0)&(d_source2(i)==1)&(d_source3(i)==1)&(d_source4(i)==1)
        r=s0111+n;
    elseif(d_source1(i)==1)&(d_source2(i)==0)&(d_source3(i)==0)&(d_source4(i)==0)
        r=s1000+n;
    elseif(d_source1(i)==1)&(d_source2(i)==0)&(d_source3(i)==0)&(d_source4(i)==1)
        r=s1001+n;
    elseif(d_source1(i)==1)&(d_source2(i)==0)&(d_source3(i)==1)&(d_source4(i)==0)
        r=s1010+n;
    elseif(d_source1(i)==1)&(d_source2(i)==0)&(d_source3(i)==1)&(d_source4(i)==1)
        r=s1011+n;
    elseif(d_source1(i)==1)&(d_source2(i)==1)&(d_source3(i)==0)&(d_source4(i)==0)
        r=s1100+n;
    elseif(d_source1(i)==1)&(d_source2(i)==1)&(d_source3(i)==0)&(d_source4(i)==1)
        r=s1101+n;
    elseif(d_source1(i)==1)&(d_source2(i)==1)&(d_source3(i)==1)&(d_source4(i)==0)
        r=s1110+n;
    else
        r=s1111+n;
    end
    %判决
    %      ss0000=dot(r,s0000);ss0001=dot(r,s0001);ss0010=dot(r,s0010);ss0011=dot(r,s0011);ss0100=dot(r,s0100);ss0101=dot(r,s0101);
    %    ss0110=dot(r,s0110);ss0111=dot(r,s0111);ss1000=dot(r,s1000);ss1001=dot(r,s1001);ss1010=dot(r,s1010);ss1011=dot(r,s1011);
    %     ss1100=dot(r,s1100);ss1101=dot(r,s1101);ss1110=dot(r,s1110);ss1111=dot(r,s1111);
    %      ss_max=max([ss0000,ss0001,ss0010,ss0011,ss0100,ss0101,ss0110,ss0111,ss1000,ss1001,ss1010,ss1011,ss1100,ss1101,ss1110,ss1111]);
    
    
    ss0000=sum(abs(r-s0000));ss0001=sum(abs(r-s0001));ss0010=sum(abs(r-s0010));ss0011=sum(abs(r-s0011));ss0100=sum(abs(r-s0100));ss0101=sum(abs(r-s0101));
    ss0110=sum(abs(r-s0110));ss0111=sum(abs(r-s0111));ss1000=sum(abs(r-s1000));ss1001=sum(abs(r-s1001));ss1010=sum(abs(r-s1010));ss1011=sum(abs(r-s1011));
    ss1100=sum(abs(r-s1100));ss1101=sum(abs(r-s1101));ss1110=sum(abs(r-s1110));ss1111=sum(abs(r-s1111));
    
    ss_max=min([ss0000,ss0001,ss0010,ss0011,ss0100,ss0101,ss0110,ss0111,ss1000,ss1001,ss1010,ss1011,ss1100,ss1101,ss1110,ss1111]);
    if ss0000==ss_max
        decis=[0 0 0 0];
    elseif ss0001==ss_max
        decis=[0 0 0 1];
    elseif ss0010==ss_max
        decis=[0 0 1 0];
    elseif ss0011==ss_max
        decis=[0 0 1 1];
    elseif ss0100==ss_max
        decis=[0 1 0 0];
    elseif ss0101==ss_max
        decis=[0 1 0 1];
    elseif ss0110==ss_max
        decis=[0 1 1 0];
    elseif ss0111==ss_max
        decis=[0 1 1 0];
    elseif ss1000==ss_max
        decis=[1 0 0 0];
    elseif ss1001==ss_max
        decis=[1 0 0 1];
    elseif ss1010==ss_max
        decis=[1 0 1 0];
    elseif ss1011==ss_max
        decis=[1 0 1 1];
    elseif ss1100==ss_max
        decis=[1 1 0 0];
    elseif ss1101==ss_max
        decis=[1 1 0 1];
    elseif ss1110==ss_max
        decis=[1 1 1 0];
    else
        decis=[1 1 1 1];
    end
    %判断是否正确,若判错,num_erro加1 错误码字数加1
    flag=0;
    if (decis(1)~=d_source1(i))
        num_erro=num_erro+1;
        flag=1;
    end
    if (decis(2)~=d_source2(i))
        num_erro=num_erro+1;
        flag=1;
    end
    if (decis(3)~=d_source3(i))
        num_erro=num_erro+1;
        flag=1;
    end
    if (decis(4)~=d_source4(i))
        num_erro=num_erro+1;
        flag=1;
    end
    if flag==1
        num_bit=num_bit+1;
    end
end
%误码结果
bt=num_bit/N;
bs=num_erro/(4*N);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [out1,out2,out3,out4]=gngauss(m,sgma)
%产生均值为m,方差为sgma的高斯噪声
if nargin==0
    m=0;sgma=1;
elseif nargin==1
    sgma=m;m=0;
end
u=rand;%均匀分布随机变量
z=sgma*(sqrt(2*log(1/(1-u))));%瑞利分布随机变量
u=rand;
out1=m+z*cos(2*pi*u);
out2=m+z*sin(2*pi*u);
out3=m+z*cos(2*pi*u+pi);
out4=m+z*sin(2*pi*u+pi);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [erro_bit_pro,erro_pro]=m_psk2(handles,SNR_dB,M)
%SNR_dB为系统信噪比

N=100;%传递的码元数
%产生数据源
x=rand(1,N);
x=floor(M*x);
[m,n]=size(x);
s0000=[0 0 0 0];
s0001=[0 0 0 1];
s0010=[0 0 1 0];
s0011=[0 0 1 1];
s0100=[0 1 0 0];
s0101=[0 1 0 1];
s0110=[0 1 1 0];
s0111=[0 1 1 1];
s1000=[1 0 0 0];
s1001=[1 0 0 1];
s1010=[1 0 1 0];
s1011=[1 0 1 1];
s1100=[1 1 0 0];
s1101=[1 1 0 1];
s1110=[1 1 1 0];
s1111=[1 1 1 1];
%转换为对应二进制的码元
bx=[];
for i=1:N
    if(x(i)<1)
        bx=[bx,s0000];
    elseif(x(i)<2)
        bx=[bx,s0001];
    elseif(x(i)<3)
        bx=[bx,s0010];
    elseif(x(i)<4)
        bx=[bx,s0011];
    elseif(x(i)<5)
        bx=[bx,s0100];
    elseif(x(i)<6)
        bx=[bx,s0101];
    elseif(x(i)<7)
        bx=[bx,s0110];
    elseif(x(i)<8)
        bx=[bx,s0111];
    elseif(x(i)<9)
        bx=[bx,s1000];
    elseif(x(i)<10)
        bx=[bx,s1001];
    elseif(x(i)<11)
        bx=[bx,s1010];
    elseif(x(i)<12)
        bx=[bx,s1011];
    elseif(x(i)<13)
        bx=[bx,s1100];
    elseif(x(i)<14)
        bx=[bx,s1101];
    elseif(x(i)<15)
        bx=[bx,s1110];
    else
        bx=[bx,s1111];
    end
end



%确定信号的进制
M = max(x) + 1;
M = 2^(ceil(log(M)/log(2)));
M = max(2, M);

SNR=10^(SNR_dB/10);
sgma=log2(M)*sqrt(1/(2*SNR));
Fc=get(handles.edit6,'string');
Fc=str2num(Fc);%modulated signal Y with carrier frequency Fc (Hz)
Fd=get(handles.edit7,'string');
Fd=str2num(Fd);%he sample frequency of the message signal X is Fd (Hz)
Fs=get(handles.edit8,'string');
Fs=str2num(Fs);% the sample frequency of Y isFs (Hz)
y_psk=DMOD(x,Fc,Fd,Fs,'psk'); %频带调制
%产生高斯噪声
%ynoise=sqrt(Fs/Fd)*sgma*(rand(1,length(y_psk)));%+j*rand(1,length(y_psk)));
for i=1:length(y_psk)
    u=rand;%均匀分布随机变量
    z=sgma*(sqrt(2*log(1/(1-u))));%瑞利分布随机变量
    u=rand;
    ynoise(i)=z*cos(2*pi*u);
end
y_rece=y_psk+ynoise;
y_dpsk=DDEMOD(y_rece,Fc,Fd,Fs,'psk',M);%频带解调

%转换为对应二进制的码元
r_bx=[];
for i=1:N
    if(y_dpsk(i)<1)
        r_bx=[r_bx,s0000];
    elseif(y_dpsk(i)<2)
        r_bx=[r_bx,s0001];
    elseif(y_dpsk(i)<3)
        r_bx=[r_bx,s0010];
    elseif(y_dpsk(i)<4)
        r_bx=[r_bx,s0011];
    elseif(y_dpsk(i)<5)
        r_bx=[r_bx,s0100];
    elseif(y_dpsk(i)<6)
        r_bx=[r_bx,s0101];
    elseif(y_dpsk(i)<7)
        r_bx=[r_bx,s0110];
    elseif(y_dpsk(i)<8)
        r_bx=[r_bx,s0111];
    elseif(y_dpsk(i)<9)
        r_bx=[r_bx,s1000];
    elseif(y_dpsk(i)<10)
        r_bx=[r_bx,s1001];
    elseif(y_dpsk(i)<11)
        r_bx=[r_bx,s1010];
    elseif(y_dpsk(i)<12)
        r_bx=[r_bx,s1011];
    elseif(y_dpsk(i)<13)
        r_bx=[r_bx,s1100];
    elseif(y_dpsk(i)<14)
        r_bx=[r_bx,s1101];
    elseif(y_dpsk(i)<15)
        r_bx=[r_bx,s1110];
    else
        r_bx=[r_bx,s1111];
    end
end

erro_bit=sum(r_bx-bx~=0);%错误的比特数
erro_bit_pro=erro_bit/(4*N);%错误比特率

erro_num=sum(x-y_dpsk~=0);%错误码元个数
erro_pro=erro_num/N;

sn=get(handles.edit9,'string');
sn=str2num(sn);
if SNR_dB==sn
    figure
    subplot(5,1,1)
    stairs([x,x(end)])
    axis([1,n+1,0,M])
    ylabel('随机信号序列')
    %title('随机信号序列')
    subplot(5,1,2)
    plot([1:length(y_psk)]/Fs,real(y_psk))
    axis([0,length(y_psk)/Fs,-2,2])
    ylabel('调制信号波形')
    %title('调制信号波形')
    subplot(5,1,3)
    plot(ynoise)
    ylabel('随机噪声波形')
   %title('随机噪声波形')
    subplot(5,1,4)
    plot([1:length(y_rece)]/Fs,real(y_rece))
    axis([0,length(y_psk)/Fs,-2,2])
    ylabel('接受加噪波形')
   %title('接受加噪波形')
   
    
    subplot(5,1,5)
    stairs([y_dpsk,y_dpsk(end)])
    hold on
    axis([1,n+1,0,M])
    hold off
    ylabel('解调信号序列')
    %title('解调信号序列')
end


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double


% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function edit5_Callback(hObject, eventdata, handles)
% hObject    handle to edit5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit5 as text
%        str2double(get(hObject,'String')) returns contents of edit5 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function edit6_Callback(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double


% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function edit7_Callback(hObject, eventdata, handles)
% hObject    handle to edit7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit7 as text
%        str2double(get(hObject,'String')) returns contents of edit7 as a double


% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function edit8_Callback(hObject, eventdata, handles)
% hObject    handle to edit8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit8 as text
%        str2double(get(hObject,'String')) returns contents of edit8 as a double


% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function edit9_Callback(hObject, eventdata, handles)
% hObject    handle to edit9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit9 as text
%        str2double(get(hObject,'String')) returns contents of edit9 as a double