[communication] matlab source code based on HF communication system simulation, including GUI

Posted by nano on Wed, 09 Feb 2022 23:16:44 +0100

1, Introduction

According to the division of the International Radio Advisory Committee (CCIR, now ITU-R), short wave refers to the electromagnetic wave with a wavelength of l00ml0m and a frequency of 3MHz30MHz. Radio communication using short wave is called short wave communication, also known as high frequency (HF) communication. In fact, in order to make full use of the advantages of shortwave short-range communication, the frequency range actually used by shortwave communication is 1.5MHz~30MHz.

Since 1921, short wave, telegraphy and other means of communication have been widely used in the military, meteorological and long-distance communication of various countries. Since the accident occurred in Rome, short wave and Telegraphy have been widely used in the world Voice broadcast and other information. Before the emergence of satellite communication, short wave played a unique and important role in international communication, flood control and disaster relief, shipwreck rescue and military communication.

Shortwave communication can use ground wave propagation, but it mainly uses sky wave propagation.

The attenuation of ground wave propagation increases with the increase of working frequency. Under the same ground conditions, the higher the frequency, the greater the attenuation. The use of ground wave is only applicable to short-range communication, and its working frequency is generally below 5MHz. The ground wave propagation is less affected by the weather and relatively stable, and the channel parameters basically do not change with time. Therefore, the ground wave propagation channel can be regarded as a constant parameter channel.

Sky wave is the part of radio wave reflected back to the ground through the ionosphere. After being reflected by the ionosphere, the inclined electromagnetic wave can be transmitted to the ground thousands of kilometers away. The propagation loss of sky wave is much smaller than that of ground wave. After multiple reflections (multi hop propagation) between the ground and ionosphere, it can reach a very far place. Therefore, global communication can be carried out by using sky wave. Sky wave propagation is extremely unstable due to the serious influence of ionospheric variation and multipath propagation, and its channel parameters change sharply with time, so it is called variable parameter channel. Sky wave can be used not only for long-distance communication, but also for short-range communication.

In areas with complex terrain and inaccessible short wave ground wave or line of sight microwave, communication can be realized by using sky wave projected at high elevation angle. Compared with satellite communication, ground microwave, coaxial cable, optical cable and other communication means, short wave communication also has many significant advantages:

1) Short wave communication can realize long-distance communication without establishing relay station, so the construction and maintenance cost is low and the construction cycle is short;

2) The equipment is simple, and can be fixed according to the use requirements for fixed-point fixed communication. It can also be carried or loaded into vehicles, ships and aircraft for mobile communication;

3) Easy circuit scheduling, convenient and rapid temporary networking, and great flexibility in use;

4) Strong resistance to natural disasters or wars. The communication equipment is small in size, easy to hide, easy to change the working frequency to avoid enemy interference and eavesdropping, and easy to recover after damage.

These are the main reasons why shortwave communication has been retained for a long time and is still widely used. Shortwave communication also has some obvious disadvantages:

1) The available frequency band is narrow and the communication capacity is small. According to international regulations, each short wave radio station occupies a frequency width of 3.7kHz, while the available frequency range of the whole short wave band is only 28.5MHz. In order to avoid mutual interference, the world can only accommodate more than 7700 communication channels, and the communication space is very crowded. And the 3kHz communication bandwidth limits the communication capacity and data transmission rate to a great extent.

2) The sky wave channel of short wave is a variable parameter channel, and the signal transmission stability is poor. HF radio communication mainly relies on the ionosphere for long-distance signal transmission. The weakness of the ionosphere as a signal reflection medium is the great variability of parameters. It is characterized by path loss, delayed walking, noise and interference, which are constantly changing with day and night, frequency and location.

On the one hand, the change of ionosphere makes the signal decline, and the amplitude and frequency of decline change constantly;

On the other hand, skywave channel has serious multipath effect, resulting in frequency selective fading and multipath delay. Selective fading distorts the signal, and multipath delay diffuses the received signal in time, which has become the main limitation of data transmission in short wave link.

3) Atmospheric and industrial radio noise interference is serious. With the development of industrial electrification, the average intensity of radio noise interference radiated by industrial appliances in the short wave band is very high. Coupled with atmospheric radio noise and interference between radio stations, in the past, long-distance short wave radio communication can be realized with the transmission power of a few watts or more. Today, 10 times or dozens of times such power may not be able to ensure reliable communication. Atmospheric and industrial radio noise is mainly concentrated at the low end of the radio spectrum, and the intensity decreases gradually with the increase of frequency. Although the noise interference in the short wave band is lower than that in the medium and long wave band, the intensity is still very high, which affects the reliability of short wave communication, especially the pulse burst noise, which often makes sudden errors in data transmission and seriously affects the communication quality.

The existence of these problems not only limits the development of short wave communication, but also can not well meet people's increasing demand for data communication, especially for high-speed data communication services. When satellite communication rose in the 1960s, short wave communication was seriously challenged because satellite communication had the advantages of stable channel, high reliability, good communication quality and large communication capacity compared with short wave communication. Many important services originally belonging to short wave communication have been replaced by satellite communication; The investment in short wave communication has been sharply reduced, and the status of short wave communication has been greatly reduced. By the late 1970s, some people even doubted the value of short wave communication.

However, practice has proved that the initial construction cost of satellite communication is high and the flexibility is limited. Satellite communication, once conceived as a possible alternative to short wave communication, can not meet the needs of users in all cases. In fact, not all users need broadband lines.

In addition, in wartime, satellite communication is easy to be attacked by the enemy, and the channel is not easy to resist the electromagnetic interference of the enemy. In contrast, shortwave communication is not only cheap and easy to implement, but also has a natural "relay system" - ionosphere, which is not easy to be "destroyed". The satellite relay system may fail or be destroyed, and the ionosphere relay system may be interrupted unless the high-altitude atomic bomb explosion. Moreover, the high-altitude atomic bomb explosion only affects the ionization density in a limited ionospheric area for a short time.

In February 1980, the defense nuclear agency of the US Department of defense proposed in a report that "the most promising solution for a country to resume communication after an atomic attack is to adopt a low-cost high-frequency communication system that can automatically find channels".

In fact, from the late 1970s and early 1980s, shortwave communication has been paid more attention again. Many countries have accelerated the research and development of short wave communication technology, and successively launched some new equipment and systems with excellent performance. In the comprehensive tactical communication plan revised by the US Army in 1979, the position of short wave communication was highlighted and listed as one of the first-line command and control communication means; Since the early 1980s, the US military has implemented a series of short wave communication improvement plans throughout the three services; In the Gulf War, the armies of the United States, France and other countries made extensive use of short wave communication and achieved outstanding results. In recent years, the armies of some other countries have also listed short wave communication as one of the important means of communication.

In addition, in some fields of civil communication, the application of short wave communication also has a development trend. Especially in recent ten years, due to the application of various new technologies, great progress has been made in short wave communication technology and equipment. Many of the original shortcomings of short wave communication have been overcome, and the quality of short wave communication link has been greatly improved. Compared with satellite communication, short wave communication has regained its youth.

function varargout = SW(varargin)
% SW M-file for SW.fig
%      SW, by itself, creates a new SW or raises the existing
%      singleton*.
%
%      H = SW returns the handle to a new SW or the handle to
%      the existing singleton*.
%
%      SW('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SW.M with the given input arguments.
%
%      SW('Property','Value',...) creates a new SW or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before SW_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to SW_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 SW
 
% Last Modified by GUIDE v2.5 26-Jul-2015 17:13:01
 
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @SW_OpeningFcn, ...
                   'gui_OutputFcn',  @SW_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(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 SW is made visible.
function SW_OpeningFcn(hObject, eventdata, handles, varargin)
set(handles.run,'enable','off');
set(handles.sendsignal,'enable','off');
set(handles.receivesignal,'enable','off');
set(handles.axes1,'visible','off');
set(handles.axes2,'visible','off');
% 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 SW (see VARARGIN)
 
% Choose default command line output for SW
handles.output = hObject;
 
% Update handles structure
guidata(hObject, handles);
 
% UIWAIT makes SW wait for user response (see UIRESUME)
% uiwait(handles.figure1);
 
 
% --- Outputs from this function are returned to the command line.
function varargout = SW_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 selectfile.
function selectfile_Callback(hObject, eventdata, handles)
%FilterSpec={'*.wav','*.wma'};
FilterSpec=('*.wav');
[fname,pname]=uigetfile(FilterSpec,'Select audio file');
sourceFile=strcat(pname,fname);
set(handles.soucepath,'String',sourceFile);
[source,samplefs] = wavread(fname);
[m2,d2]=wavfinfo(fname);
 
%title('Time domain waveform of original speech signal');?
%xlabel('time axis');?
%ylabel('amplitude?A');
handles.source = source;
handles.samplefs = samplefs;
guidata(hObject,handles);
 
 
set(handles.run,'enable','on','Backgroundcolor',[0 1 0]);
set(handles.sendsignal,'enable','on','Backgroundcolor',[0 1 0 ]);
set(handles.receivesignal,'enable','off');
set(handles.axes1,'visible','Off');
set(handles.axes2,'visible','Off');
 
 
% hObject    handle to selectfile (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 
 
 
function soucepath_Callback(hObject, eventdata, handles)
%cd (get(handles.soucepath,'string'));
%load_listbox(pwd,handles);
% hObject    handle to soucepath (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 soucepath as text
%        str2double(get(hObject,'String')) returns contents of soucepath as a double
 
 
% --- Executes during object creation, after setting all properties.
function soucepath_CreateFcn(hObject, eventdata, handles)
% hObject    handle to soucepath (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
 
 
% --- Executes on selection change in modulationtype.
function modulationtype_Callback(hObject, eventdata, handles)
switch get(handles.modulationtype,'value')
    case 1
        set(handles.modparm_txt,'String','Modulation index:','Visible','on');
        set(handles.modparm,'Visible','on','String','0.2');
         set(handles.text13,'Visible','on');
        set(handles.demodmethod,'Style','popupmenu','string',{'Coherent demodulation ','Envelope detection'});
    case 2
        set(handles.modparm_txt,'Visible','off');
        set(handles.modparm,'Visible','off');
         set(handles.text13,'Visible','off');
        set(handles.demodmethod,'Style','edit','string','Coherent demodulation');
    case 3
        set(handles.modparm_txt,'String','Maximum frequency offset:','Visible','on');    
         set(handles.text13,'Visible','off');
        set(handles.modparm,'Visible','on','String','80000');
        set(handles.demodmethod,'Style','edit','string','Coherent demodulation');
end    
% hObject    handle to modulationtype (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 
% Hints: contents = get(hObject,'String') returns modulationtype contents as cell array
%        contents{get(hObject,'Value')} returns selected item from modulationtype
 
 
% --- Executes during object creation, after setting all properties.
function modulationtype_CreateFcn(hObject, eventdata, handles)
% hObject    handle to modulationtype (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
 
% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
 
 
 
function modparm_Callback(hObject, eventdata, handles)
modparm = str2double(get(handles.modparm,'String'));
if modparm>1
    errordlg('Modulation index cannot exceed 1','error');
    return
end 
% hObject    handle to modparm (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 modparm as text
%        str2double(get(hObject,'String')) returns contents of modparm as a double
 
 
% --- Executes during object creation, after setting all properties.
function modparm_CreateFcn(hObject, eventdata, handles)
% hObject    handle to modparm (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
 
 
 
function minfreq_Callback(hObject, eventdata, handles)
% hObject    handle to minfreq (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 minfreq as text
%        str2double(get(hObject,'String')) returns contents of minfreq as a double
 
 
% --- Executes during object creation, after setting all properties.
function minfreq_CreateFcn(hObject, eventdata, handles)
% hObject    handle to minfreq (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
 
 
 
function maxfreq_Callback(hObject, eventdata, handles)
% hObject    handle to maxfreq (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 maxfreq as text
%        str2double(get(hObject,'String')) returns contents of maxfreq as a double
 
 
% --- Executes during object creation, after setting all properties.
function maxfreq_CreateFcn(hObject, eventdata, handles)
% hObject    handle to maxfreq (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
 
 
 
function upsamplefactor_Callback(hObject, eventdata, handles)
% hObject    handle to upsamplefactor (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 upsamplefactor as text
%        str2double(get(hObject,'String')) returns contents of upsamplefactor as a double
 
 
% --- Executes during object creation, after setting all properties.
function upsamplefactor_CreateFcn(hObject, eventdata, handles)
% hObject    handle to upsamplefactor (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
 
 
 
function fc_Callback(hObject, eventdata, handles)
fc = str2double(get(handles.fc,'String'));
if fc<1.6||fc>30
    errordlg('Please set the carrier frequency to 1.6MHz To 30 MHz between','error');
    return
end 
% hObject    handle to fc (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 fc as text
%        str2double(get(hObject,'String')) returns contents of fc as a double
 
 
% --- Executes during object creation, after setting all properties.
function fc_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fc (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
 

 

2, Source code

3, Operation results

4, Remarks

Complete code or write on behalf of QQ1575304183

Topics: MATLAB