Need to obtain two unknown coefficients

2 ビュー (過去 30 日間)
Stelios Fanourakis
Stelios Fanourakis 2017 年 9 月 4 日
コメント済み: Walter Roberson 2017 年 9 月 5 日
load('S_chest.mat');
load('S_abdomen.mat');
x= S_chest;
y= S_abdomen;
A=zeros(5955,2);
A(1,1)=x(1);
for n= 2:5953
A(n,1)= x(n);
A(n,2)= x(n-1);
end
B=zeros(5955,2);
B(1,1)=y(1);
for i=2:5953
B(i,1)=y(i);
end
w= A/B;
w(w==0)= [];
disp(w);
I need to obtain w1, w2. Matlab comes out of many results but I only need two. How am I going to get them?
  2 件のコメント
Wonsang You
Wonsang You 2017 年 9 月 4 日
The question is unclear. What are w1 ans w2? Are they some variables?
dpb
dpb 2017 年 9 月 4 日
I'm guessing OP is trying to fit some model but isn't clear what model is wanted. Knowing the size and what are the contents of the two data files might help some but as you point out, a clear problem statement would be better still.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2017 年 9 月 4 日
My guess is that you want
w = A\B(:,1);
  3 件のコメント
Stelios Fanourakis
Stelios Fanourakis 2017 年 9 月 5 日
Results are different for w1,w2 whether A\B or B\A. Mathematically as we shift x to the opposite side of equation comes B\A
Walter Roberson
Walter Roberson 2017 年 9 月 5 日
Vec = @(M) M(:);
A = [ Vec(x(2:end)), Vec(x(1:end-1))];
Now, A*x = y .
Pretend for a moment that A is a square matrix (so inv(A) exists). Pre-multiply by inv(A), getting
inv(A)*A*x = inv(A)*y
inv(A)*A would be the identity matrix, so you would have
x = inv(A)*y
which is the operation A\y

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by