construction of diagonal matrix of functions
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have three functions: f_1, f_2, and f_3.
I want to construct the matrix A for the following linear system:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/432688/image.png)
so the first line of the system will be f_2(x_1) + f_3(x_2) = q_1
second line will be f_1(x_1) + f_2(x_2) + f_3(x_3) = q_2
third line f_1(x_2) + f_2(x_3) + f_3(x_4) = q_3
and so on.
Thank you.
0 commentaires
Réponse acceptée
Plus de réponses (1)
Matt J
le 28 Nov 2020
Modifié(e) : Matt J
le 28 Nov 2020
function A=func(x,n)
e=zeros(1,n-2);
f1=f_1(x);
f2=f_2(x);
f3=f_3(x);
A=toeplitz([f2,f1,e], [f2,f3,e]);
end
4 commentaires
Matt J
le 28 Nov 2020
Modifié(e) : Matt J
le 28 Nov 2020
so the first line of the system will be f_2(x_1) + f_3(x_2) = q_1
I'm still not sure what you want, because your drawings and your equations say different things. You're new drawing is equivalent to,
x_1*f_2(alpha) + x_2*f_3(alpha) = q_1
x_1*f_1(alpha) + x_2*f_2(alpha) + x_3*f_3(alpha) = q_2
...
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!