Trouble with integration of double integer

1 Ansicht (letzte 30 Tage)
Bahaa Soliman
Bahaa Soliman am 17 Mai 2020
I'm new to MATLAB and I'm trying to integrate a value for a fourier series, the code is as follows:
clear all;
close all;
clc;
%Initial Variables
N = 8096; %Sum of additions to be done
T = 1e-3; %OFDM Symbol Period (TIME Domain!)
A = zeros(1,N-1); %First Data Sequence
B = zeros(1,N-1); %Second Data Sequence
t = T/8096; %Value in the range of 0-t to be constantly simulated on!
t_new = 0; %Updated value of t
x = zeros(1,N-1); %Complex Signal (Cosine Component)
y = zeros(1,N-1); %Complex Signal (Sine Component)
sum_x = 0; %Sum of x (Complex Signal) values!
%Setting up equations:
for k = 1:1:N-1
x(k+1) = A(k)*cos(2*pi*(k)*t_new); %Cosine Component of the subcarrier
y(k+1) = B(k)*sin(2*pi*(k)*t_new); %Sine Component of the subcarrier
t_new = t_new + t;
A(k+1) = int((x(k+1))*cos(2*pi*k*t), T, 0);
end
I keep getting an error that states as follows:
Undefined function 'int' for input arguments of type 'double'.
Error in GroupProjectCode (line 22)
A(k+1) = int((x(k+1))*cos(2*pi*k*t), T, 0);
Suggestions?
  3 Kommentare
David Goodmanson
David Goodmanson am 17 Mai 2020
Hi Bahaa,
int is for use on symbolic variables, not numeric variables as you have.
Bahaa Soliman
Bahaa Soliman am 19 Mai 2020
Thank you David. :)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Devineni Aslesha
Devineni Aslesha am 21 Mai 2020
In the given code, as x(k+1))*cos(2*pi*k*t) is a constant value, integration of this constant can be done as shown below.
fun = @(z) x(k+1)*cos(2*pi*k*t) + 0*z;
A(k+1) = integral(fun, 0, T);
For more information, refer the following link.

Community Treasure Hunt

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

Start Hunting!

Translated by