How to find coefficient matrix?

4 Ansichten (letzte 30 Tage)
Tom Braylovsky
Tom Braylovsky am 14 Mai 2022
Bearbeitet: Torsten am 14 Mai 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!

Akzeptierte Antwort

Torsten
Torsten am 14 Mai 2022
Bearbeitet: Torsten am 14 Mai 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

Weitere Antworten (0)

Kategorien

Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by