# Jus a simple expression (easy question)

1 view (last 30 days)
Paul Rogers on 9 May 2020
Commented: Ameer Hamza on 10 May 2020
Hi guys, I am just having some iussues with this formula, could some one please help me?
n=5, r=5.

Ameer Hamza on 9 May 2020
What is M? How is defined? How is defined?
Paul Rogers on 9 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

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

Show 1 older comment
Ameer Hamza on 10 May 2020
Ok. I noticed that you are using R2014b. It that release, code in my answer will not work. The following code will work for R2014b
clear
clc
close all
a_trasp= [1.71513 0.59747 0.09479 0.02658 0.00638
-0.15109 -0.01716 -0.00273 0.00027 0.00025
-0.03707 -0.04825 -0.00764 -0.00317 -0.00095
-0.04567 -0.01861 -0.00295 -0.00091 -0.00023
0.0323 0.00643 0.00102 0.00015 0.00001
];
a = a_trasp';
%i=5; %x_i mass flow
%j=5; %N_j or x_j rotational speed
n=5; %number of mesuraments for x
r=5; %number of mesuraments for y
FlowMeasurements = chebpts(5,[-0.2,0.8]); % decido quali punti della massa mi servono secondo Chebyshev
SpeedMeasurements = chebpts(5,[25000, 55000]); %in questa variante decido quali sono le velocità richieste da Chebyshev
result = 0;
for i=1:n
for j=1:r
result = result + a(i,j).*cos(i.*cos(i)).*cos(j.*cos(j));
end
end
Walter Roberson on 10 May 2020
Is the for j=r correct? Should it be for j=1:r ?
Ameer Hamza on 10 May 2020
Thanks for correction. It should be 1:r

R2014b

### Community Treasure Hunt

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

Start Hunting!