least square method.getting error using '\' or linsolve. pls help
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
any kind folks who can help me out. i'm trying to implement least square method, but i'm getting some error using linsolve and '\' function. please help, and million thanks in advance!
for a =1:400
for P=1:49
o=(P-1)*243;
for r=1:35
if r==35
t=-2;
pA1(1:5,1,r,P)=A(7*r-6+o:7*r+t+o,a);
pB1(1:5,1,r,P)=B(7*r-6+o:7*r+t+o,a);
beta(r,P)=linsolve(pA1,pB1); <--- error
% beta(r,P)=pA1\pB1;
else
t=0;
pA(1:7+t,1,r,P)=A(7*r-6+o:7*r+t+o,a);
pB(1:7+t,1,r,P)=B(7*r-6+o:7*r+t+o,a);
beta(r,P)=linsolve(pA,pB);; <---- error
% beta(r,P)=pA\pB;
end
end
end
2 Kommentare
Stephen23
am 23 Jan. 2015
Can you please tell us what the complete error message is. We cannot read minds, and we also cannot read what is on your computer screen.
Antworten (1)
Matt J
am 23 Jan. 2015
Bearbeitet: Matt J
am 23 Jan. 2015
Your pA1 and pB1 are 4D arrays. However linsolve(A,B) expects A and B to be 2D matrices, and similarly for '\'.
4 Kommentare
Matt J
am 23 Jan. 2015
Nope, no tips. We have no way of understanding what your code is trying to do unless you explain it to us.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!