Issues simulating OFDM and plotting it out
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Good day everyone: currently I'm attempting an assignment exploring exactly how the OFDM works, and my experience with the mathematics or the MATLAB functions is lagging in comparison to the requirements of the assignment. The equations provided for the assignment are attached as images along with this question, but simulating the OFDM Modulation of these equations is not functioning properly, and we are requested to plot the requested histogram containing the amplitude of the instantaneous signal values (after simulating it!). I would appreciate if anyone can have a glimpse through my code and let me know what can be fixed (histogram commands are not working either!). (There are follow up parts, but I am still trying to code them on my own before requesting further guidance!):
Code:
clear all;
close all;
clc;
syms x(t); %Complex Signal
syms Ak; %First Signal
syms Bk; %Second Signal
N = 8096; %Number of Cycles
T = 1e-3; %Time period of a cycle
syms t; %Variable to be integrated with respect to!
t_step = T/N; %Steps of input for final plot!
time = 0;
for k = 0:1:2 %Change to N-2 in the end! (Reduced value for Simulation Purposes!)
Ak(k+1) = int(x(t)*cos(2*pi*(k+1)*t),t,0,T);
Bk(k+1) = int(x(t)*sin(2*pi*(k+1)*t),t,0,T);
x(t) = sum(Ak(k+1)*cos(2*pi*(k+1)*t) + Bk(k+1)*sin(2*pi*(k+1)*t));
xK(k+1) = subs(x(t),t,time(k+1)); %Substituting t = (k+1)
time(k+2) = time(k+1) + t_step; %Incrementing the timeStep
%xFinal = subs(x(t),t,time(k+2));
end
xK_Final = sum(xK); %Adding all xK values up!
%(For the last N-1 Variable, Ak = cos(2*pi*k*t)^2) (SAME FOR Bk!) (Question states the final value is different from the rest of the sequence of the signals!)
Ak(k+1) = int(((x(t)*(cos(2*pi*(k+1)*t)^2))),t,0,T);
Bk(k+1) = int(((x(t)*(sin(2*pi*(k+1)*t)^2))),t,0,T);
%Plotting the Histogram plots:
figure(1);
histogram(Ak(k+1));
figure(2);
histogram(Bk(k+1));
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu OFDM finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!