How to find coefficient matrix?

8 views (last 30 days)
Tom Braylovsky
Tom Braylovsky on 14 May 2022
Edited: Torsten on 14 May 2022
Hello everyone,
I need to find a coefficient matrix called 'A'.
I heve vector 'Re' and a result vector 'f'. Bouth vectors are (1:430) size and are known.
The equation looks like this: A * Re = f
how can i do it?
Vectors file included, only (1:430) is needed.
Equation system format included. Matrix 'A' is the a's, 'Re' is the X's and 'f' is the Y's.
Hope I was clear enougth, thanks for the help!

Accepted Answer

Torsten
Torsten on 14 May 2022
Edited: Torsten on 14 May 2022
I assume the last xi^n should be xi^m in
sum_{i=1}^{n} y_i*x_i^n
x = [1 3 5 7 9];
y = [3 -1 3 78 -0.2];
m = 4;
xx = x.^((0:2*m).');
xxx = sum(xx,2).';
A = reshape(cell2mat(arrayfun(@(i)xxx(i:i+4),1:m+1,"UniformOutput",false)),m+1,m+1);
b = xx(1:m+1,1:m+1)*y.';
a = A\b

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!