How can I fix this error?

2 views (last 30 days)
Kwan Ho NG
Kwan Ho NG on 30 Mar 2021
Commented: Kwan Ho NG on 30 Mar 2021
  2 Comments
James Tursa
James Tursa on 30 Mar 2021
In the future, always post your code as text highlighted by the CODE button. Do not post your code as images because we can't copy & run pictures.
Kwan Ho NG
Kwan Ho NG on 30 Mar 2021
clear;
fs=10^4;
fc=1000; %carrier frequency
T=16*(1/500); %1/500 is the bit duration; 16bits data
Ts=1/fs; %Ts is the sampling duration for a given frequency = 0.0001s
N=T/Ts; %total number of samples for the 16 bit data
sin_wave= sin(2*pi*fc*(0:Ts:(N-1)*Ts));
cos_wave= cos(2*pi*fc*(0:Ts:(N-1)*Ts));
Ns=40;
data_I=[1 1 1 1 1 -1 1 -1];
data_Q=[-1 -1 1 1 -1 1 -1 -1];
sum_unm=8;
for i=1:sum_unm
for j=1:Ns
data_I_exit((i-1)*Ns+j))=data_I(i);
data_Q_exit((i-1)*Ns+j))=data_Q(i);
end;
end;
for i=1:N
out_QPSK(i)=data_I_exit(i)*cos_wave(i)+data_I_exit(i)+cos_wave(i);
end;
x=0:Ts:T-Ts
plot(x,out_QPSK)

Sign in to comment.

Answers (1)

James Tursa
James Tursa on 30 Mar 2021
Delete the extra closing parentheses. I.e., delete the paren where the red underline is.

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!