Running 2 found variables thru another script
显示 更早的评论
So this is based off a question I had earlier involving this code below.
function fit=get_linear_fit_2(data)
s=size(data);
Syx=0;
Sxx=0;
Sy=0;
Sx=0;
for n=1:s(1)
Syx=data(n,1)*data(n,2)+Syx;
Sxx=(data(n,1))^2+Sxx;
Sx=data(n,1)+Sx;
Sy=data(n,2)+Sy;
end
m=[Sxx,Sx;Sx,s(1)];
c=[Syx;Sy];
disp(m)
disp(c)
fit=Cramers_rule(m,c)
end
%%%%%%
So at the end I get an "m" and a "c", so I have a cramers rule script that I want to run these thru and get an answer for using the command I have above, can anybody give any insight as to how I can modify that line to work. I get the "too many output arguments" error when I run it thru.
Cramers rule code
function Cramers_rule(m,c)
s=size(m);
n=1;
dm=det(m);
while s(2)>=n
a=m;
a(:,n)=c(:);
y(n)=det(a)/dm;
disp(y(n))
n=n+1;
end
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!