Matrix calculus and solving system of equations
이전 댓글 표시
I have a Aleator.xlsx table from I imported the integer value in D => and construct a matrix in the first column we write the difference
DM(i,1) = D(i,1)-D(i+1,1); .... DM(i,10) = D(i,10)-D(i+1,10); and b1= D(1027,1).. b10= D(1017,1);
I have to calculus the coeficents a11, ...a10,1 from equations
b1 = DM(1,1)*a11+DM(1,2)*a21+DM(1,3)*a31+DM(1,4)*a41+DM(1,5)*a51+DM(1,6)*a61+DM(1,7)*a71+DM(1,8)*a81+DM(1,9)*a91+DM(1,10)*a101;
b10 = DM(10,1)*a11+DM(10,2)*a21+DM(10,3)*a31+DM(10,4)*a41+DM(10,5)*a51+DM(10,6)*a61+DM(10,7)*a71+DM(10,8)*a81+DM(10,9)*a91+DM(10,10)*a101;
And write the result in Vector Rez = [a11 a21 ... a101];
Please Help!
채택된 답변
추가 답변 (1개)
Dheeraj
2024년 9월 3일
Hi Viorel-Mihai Popescu,
You can use "xlsread" function to read to the file and the data associated with it. you need to set up a system of linear equations based on the provided matrix equations and solve for the coefficients
. Below is an example to do the same assuming you have "DM" matrix created using your logic.
Formulate the system of equations
% We need to solve DM * a = b
% DM is (nRows - 1) x nCols matrix
% b is a column vector of size nCols
% Check if we have enough equations and variables
if size(DM, 1) < nCols
error('Insufficient number of equations.');
end
% Solve for coefficients a
% We are solving DM * a = b
% Using left division to find a
a = DM \ b;
Thank You.
댓글 수: 3
Viorel-Mihai Popescu
2024년 9월 3일
이동: Torsten
2024년 9월 3일
Torsten
2024년 9월 3일
Insert the lines
size(DM)
size(b)
before using the command
a = DM \ b;
What does MATLAB print out for the two sizes ?
Viorel-Mihai Popescu
2024년 9월 3일
카테고리
도움말 센터 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!