0

I have two lists of functions, for instance: log(n*x), n=1:2017 and cos(m*x), m=1:6. I want/need to construct the matrix product of these vectors and then integrating each element of the matrix between 10 and 20.

I have read this post: Matrix of symbolic functions but I think that it is not useful for this problem. I'm trying to do this by using a loop but I can not get it.

Thanks in advance for reading it.

Nico Schlömer
  • 53,797
  • 27
  • 201
  • 249
Benigno
  • 3
  • 2

1 Answers1

0

You can solve this problem by assigning the appropriate vectors to n and m as follows:

n = (1:2017)'; % column vector
m = 1:6; % row vector

syms x;
l = log(n*x); % column vector of logs
c = cos(m*x); % row vector of cos

product = l*c; % matrix product
i = int(product, x, 10, 20); % integral from 10 to 20
iDouble = double(i); % convert the result to double
m7913d
  • 10,244
  • 7
  • 28
  • 56