solving a multivariate equation (4 equations, 4 variables) for n rows data using loop
显示 更早的评论
I wrote this code to solve a multivariate equation (4 equations, 4 variables) while aprim0,bprim0, xmid, and ymid are available
for i = 1:n
eqn1 = yup(i,1) - (aprim0(i,1)*xup(i,1)) - bprim0(i,1) == 0;
eqn2 = ydown(i,1) - (aprim0(i,1)*xdown(i,1)) - bprim0(i,1) == 0;
eqn3 = sqrt((xup(i,1) - xmid(i,1))^2 + (yup(i,1) - ymid(i,1))^2) - 0.008 == 0;
eqn4 = sqrt((xdown(i,1) - xmid(i,1))^2 + (ydown(i,1) - ymid(i,1))^2) - 0.008 == 0;
eqns = [eqn1, eqn2, eqn3, eqn4];
vars=[xup(i,1), yup(i,1), xdown(i,1), ydown(i,1)];
sol = solve('eqns', 'vars');
end
but it did not work in solve function, where is my mistake?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!