Trouble with integration of double integer
1 次查看(过去 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?
3 个评论
David Goodmanson
2020-5-17
Hi Bahaa,
int is for use on symbolic variables, not numeric variables as you have.
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!