Trouble with integration of double integer
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
David Goodmanson
le 17 Mai 2020
Hi Bahaa,
int is for use on symbolic variables, not numeric variables as you have.
Réponses (1)
Devineni Aslesha
le 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.
0 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!