Trouble with integration of double integer

조회 수: 1 (최근 30일)
Bahaa Soliman
Bahaa Soliman 2020년 5월 17일
답변: Devineni Aslesha 2020년 5월 21일
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
David Goodmanson
David Goodmanson 2020년 5월 17일
Hi Bahaa,
int is for use on symbolic variables, not numeric variables as you have.
Bahaa Soliman
Bahaa Soliman 2020년 5월 19일
Thank you David. :)

댓글을 달려면 로그인하십시오.

답변 (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