Trouble with integration of double integer

2 次查看(过去 30 天)
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?

回答(1 个)

Devineni Aslesha
Devineni Aslesha 2020-5-21
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.

类别

Help CenterFile Exchange 中查找有关 Numbers and Precision 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by