Info

This question is closed. Reopen it to edit or answer.

Jus a simple expression (easy question)

1 view (last 30 days)
Paul Rogers
Paul Rogers on 9 May 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi guys, I am just having some iussues with this formula, could some one please help me?
n=5, r=5.
  2 Comments
Ameer Hamza
Ameer Hamza on 9 May 2020
What is M? How is defined? How is defined?
Paul Rogers
Paul Rogers on 9 May 2020
Edited: Walter Roberson on 10 May 2020
M doesn't matter, let's say aij is this matrix.
a =
1.7151 -0.1511 -0.0371 -0.0457 0.0323
0.5975 -0.0172 -0.0483 -0.0186 0.0064
0.0948 -0.0027 -0.0076 -0.0029 0.0010
0.0266 0.0003 -0.0032 -0.0009 0.0001
0.0064 0.0003 -0.0009 -0.0002 0.0000
Ti= cos(icos^-1(i))
Tj= cos(icos^-1(j))
n=5
r=5

Answers (1)

Ameer Hamza
Ameer Hamza on 9 May 2020
Try this
a = [...
1.7151 -0.1511 -0.0371 -0.0457 0.0323
0.5975 -0.0172 -0.0483 -0.0186 0.0064
0.0948 -0.0027 -0.0076 -0.0029 0.0010
0.0266 0.0003 -0.0032 -0.0009 0.0001
0.0064 0.0003 -0.0009 -0.0002 0.0000];
n=5;
r=5;
i = 0:r-1;
j = 0:n-11;
Ti= cos(i.*acos(i));
Tj= cos(i.*acos(i));
result = sum(a.*Ti.'.*Tj, 'all')
Result
result =
54.6082
  4 Comments
Walter Roberson
Walter Roberson on 10 May 2020
Is the for j=r correct? Should it be for j=1:r ?
Ameer Hamza
Ameer Hamza on 10 May 2020
Thanks for correction. It should be 1:r

Products


Release

R2014b

Community Treasure Hunt

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

Start Hunting!