how do i solve for the unknown variable
조회 수: 1 (최근 30일)
이전 댓글 표시
I have 3 axis x y and z. I wish to find Z such that the sum of the squares would be equal to 1.
the data is stored in a vector with 3 columns. I want to substitute the last one with an unknown such that the sum of the squares of x y and z would equal to 1.
syms zz
for i=1:90
g(i) = sqrt (gx1(i,1) * gx1(i,1) + gy1(i,1) * gy1(i,1) + zz * zz) - 1
roots(i) = solve(g(i),zz);
end
I would greatly appreciate the help. thanks Rafael
댓글 수: 0
답변 (1개)
Razvan
2012년 9월 28일
If you have the vectors x and y
e.g.
x = 0.5 * rand(10, 1);
y = 0.5 * rand(10, 1);
Then the z is simply
z = sqrt(1 - x.^2 - y.^2);
plus or minus that, depending if you want the positive or the negative root.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!