I'm trying to plot the equation shown in the image, but I'm not sure how to apply the Galois Seq. "gf()" here.
Can you please help me with this ?
Expected magnitude waveform.
clear all
close all
clc
%%
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1024; % Length of signal
t = 2*(0:L-1)*T; % Time vector
signal = 0;
m = 5;
for k=1:((2^m)-1)
g = gf(2^m);
signal = signal + g(k).*exp(1i*2*pi*k*t)/((2^m)-1);
end
figure
subplot(2,2,1)
plot(t,signal)
title('signal')

 Respuesta aceptada

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 30 de En. de 2022
Here you'd need to define the purpose of using GF.
If you are aiming to select any randomly selected values of GF while computing the wave form fcn values, this can be done with the followings:
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1024; % Length of signal
t = 2*(0:L-1)*T; % Time vector
signal = 0;
m = 5;
x = [0 1 1; 0 1 0; 1 1 1];
for k=1:((2^m)-1)
g =gf(x,m);
G = g.x(:);
signal = signal + double(G(randi(numel(G))))*exp(1i*2*pi*k*t)/((2^m)-1);
end
figure
subplot(2,2,1)
plot(t,real(signal))
title('signal: RE')
subplot(2,2,2)
plot(t,imag(signal))
title('signal: IM')

3 comentarios

Mohamed Ahmed
Mohamed Ahmed el 30 de En. de 2022
Editada: Mohamed Ahmed el 30 de En. de 2022
ooh, could you explain to me what did you do exactly ?
what does x represent here ?
and what if I don't want random selected values of GF, how can I change the code ?
Thank you :)
Sulaymon Eshkabilov
Sulaymon Eshkabilov el 30 de En. de 2022
If you want to have different values of x, then change the values of x or if you want to have specific values for x, then speficy them.
See this DOC for more info on x.
Mohamed Ahmed
Mohamed Ahmed el 31 de En. de 2022
Editada: Mohamed Ahmed el 31 de En. de 2022
Should they all be changed to the same values? and how will that affect the signal ?
And what are these spikes in the middle of the signal ?

Iniciar sesión para comentar.

Más respuestas (1)

Benjamin Thompson
Benjamin Thompson el 26 de En. de 2022

0 votos

This lines needs an extra set of parenthesis:
signal = signal + g(k).*exp((1i*2*pi*k*t)/((2^m)-1));
But the way you are using the gf function does not match how MATLAB describes it in the documentation.

Preguntada:

el 25 de En. de 2022

Editada:

el 31 de En. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by