Hello,
For a research project I have to find the coefficients corrsponding to the value of importance of the previous days.
for example:
_a = rand(1024,4);
b= rand(1024,1);
t=a\b;
btest=a*t;_
where t would give me the coefficients. However when I do the test by computing btest and compare it with b, this gives me a completely other result. How is this possible? Am I doing something wrong or is this because b is calculated with approximations by matlab?
Thanks!

답변 (2개)

Mischa Kim
Mischa Kim 2014년 3월 2일
편집: Mischa Kim 2014년 3월 2일

0 개 추천

Derck, you are working with an overdetermined system: 1024 equations in 4 unknowns. Chances that the system results in an exact solution are slim.
Try, instead (to get confidence in MATLAB)
a = rand(1024,1024);
b = rand(1024,1);
t = a\b;
btest = a*t;
norm(b-btest,inf)
ans =
8.495634751248815e-13
Image Analyst
Image Analyst 2014년 3월 2일

0 개 추천

btest won't equal b. I don't know if that's what you're thinking, but it won't happen unless you have perfect data to begin with. You're doing an ordinary least squares solution so your solution with be a nice smooth analytical line that goes nicely between the random points. Your test arrays are particularly badly chosen - in fact I don' think you could have possibly chosen worse sets of data . You're going to have no sensible equations that map a bunch of random values into another bunch of random values with a simple weighted sum of the input values.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2014년 3월 2일

답변:

2014년 3월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by