How to find coefficient matrix?

8 visualizzazioni (ultimi 30 giorni)
Tom Braylovsky
Tom Braylovsky il 14 Mag 2022
Modificato: Torsten il 14 Mag 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!

Risposta accettata

Torsten
Torsten il 14 Mag 2022
Modificato: Torsten il 14 Mag 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

Più risposte (0)

Categorie

Scopri di più su Language Fundamentals in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by