help needed on using "solve" for equation including element from array
Show older comments
Hello, I'm having problem when using "solve" function. For example,
clear a k x y;
a=[1, 2];
for k=1:1:2
y=subs(abs(solve('x^2+a(k)^2-9')))
end
Matlab gave me
y =
abs(a(2)^2-9)^(1/2)
abs(a(2)^2-9)^(1/2)
instead of numerical results. Of course, the real problem I'm trying to solve is much more complicated, and the array "a" is calculated by another code and actually a more complicated matrix, so I cannot manually assign each a(k) for a numerical number. Could anybody help me on this? I tried to search for an answer here but failed. Many thanks for any help.
Accepted Answer
More Answers (0)
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!