How to implement Airband (Aircraft band) in this MATLAB code

11 views (last 30 days)
I am researching Airband (Aircraft Band) for the Telecommunication course, but the professor didn't explain what to do exactly in simulation except saying that I have to do AM modulation scheme. I found a code online but don't know how to implement (108 - 132) Mhz in it or should I do something else in it? really need your guys help the only thing so far I can assume is the values for (Ac, Am, Fc, Fm, Fs, m ,t) are assumption by our part in the research.
clc
clear all
% Ac=input('Enter carrier signal amplitude: ');
% Am=input('Enter message signal amplitude: ');
% Fc=input('Enter carrier frequency: ');
% Fm=input('Enter message frequency: ');% fm<fc
% m=input('Enter modulation index: ');
% t=input('Enter time period: ');
%To plot Modulating,carrier and Amplitudede modulated signals
echo on
Ac= 10;
Am=6.5;
Fc=20000;
Fm = 2000;
Fs=2000;%sampling frequency
Ta= 1/Fs;
t= 0:Ta/1000:6*Ta;
Ym=Am*sin(2*pi*Fm.*t);
Yc= Ac*sin(2*pi*Fc.*t);
m=Am/Ac;
y= Ac*(1+m*sin(2*pi*Fm.*t)).*sin(2*pi*Fc.*t);
subplot(3,1,1),plot(t,Ym);
title('Modulating signal')
xlabel('time(sec)');
ylabel('Amplitude ');
subplot(3,1,2),plot(t,Yc);
title('Carrier signal')
xlabel('time(sec)');
ylabel('Amplitude ');
subplot(3,1,3),plot(t,y,'r');
title('Modulated signal')
xlabel('time(sec)');
ylabel('Amplitude');
  36 Comments
Abdul Rahman Alam
Abdul Rahman Alam on 24 Dec 2021
ok, but at this stage am I safe to assume that I am done or bit tinkering needed for this code?
since i need start writitng report today, since I have submission on sunday.
Star Strider
Star Strider on 24 Dec 2021
‘ok, but at this stage am I safe to assume that I am done or bit tinkering needed for this code?’
Yes!
Please post back with the results. I would give high marks for the effort and results.

Sign in to comment.

Accepted Answer

Abdul Rahman Alam
Abdul Rahman Alam on 24 Dec 2021
Edited: Abdul Rahman Alam on 24 Dec 2021
I would like thank @Star Strider for helping me out understanding this project and fixing my mistakes. without further ado: this my code now and what changes I have made:
clc
clear all
close all
%To plot Modulating,carrier and Amplitudede modulated signals
Ac= 10; %Carrier signal amplitude
Am= 7; %Message signal amplitude
Fc=123*(10^(6)); %Carrier frequency
Fm=6*(10^(3)); %Message frequency %Fm<Fc
Fs=2*(10^(3)); %sampling frequency
Ta= 1/Fs; %sampling period
T= 0:Ta/(1*(10^(6))):6*Ta; %time
Yc= Ac*sin(2*pi*Fc.*T); %Carrier signal equation
Ym=Am*sin(2*pi*Fm.*T); %Message signal equation
M=Am/Ac; %Modulation index %Am/Ac
Y= Ac*(1+M*sin(2*pi*Fm.*T)).*sin(2*pi*Fc.*T); %Amplitude modulation
figure(1)
subplot(3,1,1),plot(T,Ym); %Plot 1
title('Modulating signal')
xlabel('Time(sec)');
ylabel('Amplitude ');
subplot(3,1,2),plot(T,Yc); %Plot 2
title('Carrier signal')
xlabel('Time(sec)');
ylabel('Amplitude ');
subplot(3,1,3),plot(T,Y,'r'); %Plot 3
title('Modulated signal')
xlabel('Time(sec)');
ylabel('Amplitude');
%Part 2
t = T; % Time Vector
data = Y; % Time-Domain Data
figure (2)
plot(t, data)
grid
xlabel('Time Vector(sec)')
ylabel('Amplitude')
title('Time-Domain Plot')
Then to make sure you have the correct answer you have to use fourier transofr command "fft" as shown below to se if it double sided band
L = numel(t); % Vectors Length
Ts = mean(diff(t)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
NFFT = 2^(nextpow2(L)+1); % Length Of 'fft'
datam = data - mean(data); % Subtract Mean From Data (Shows Peaks Better)
FTdata = fft(datam,NFFT)/L; % Calculate Fourier Transform
Fv = linspace(0, 1, NFFT/2+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
[pk,ix] = max(abs(FTdata(Iv))); % Peak Amplitude & Index (Optional)
CF = Fv(ix);
[pks, locs, wd, pr] = findpeaks(abs(FTdata(Iv))*2, 'MinPeakProminence',3);
figure (3)
plot(Fv, abs(FTdata(Iv))*2)
hold on
plot(Fv(locs), pks, '^r', 'MarkerFaceColor','r') % (Optional)
hold off
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Frequency-Domain Plot')
xlim([-1 1]*1E4+CF)
ylim([0 12])
text(Fv(locs), pks, compose('Freq: %7.3f MHz', Fv(locs)/1E6), 'Horiz','center', 'Vert','bottom')
also to make sure my frequency is close to the Fc Carrier signal frequency as close as possible
  11 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!